Quantum Computer Amendable Sparse Matrix Equation Solver

ABSTRACT

A generalization of the Harrow/Hassidim/Lloyd algorithm is developed by providing an alternative unitary for eigenphase estimation adopted from research in the area of quantum walks, which has the advantage of being well defined for any arbitrary matrix equation. The procedure is most useful for sparse matrix equations, as it allows for the inverse of a matrix to be applied with (Nnz log(N)) complexity, where N is the number of unknowns, and Nnz is the total number of nonzero elements in the system matrix. This efficiency is independent of the matrix structure, and hence the quantum procedure can outperform classical methods for many common system types. We show this using the example of sparse approximate inverse (SPAI) preconditioning, which involves the application of matrix inverses for matrices with Nnz=(N).

This application claims the benefit under 35 U.S.C. 119(e) of U.S. provisional application Ser. No. 63/287,806, filed Dec. 9, 2021.

FIELD OF THE INVENTION

The present invention relates to a method of solving matrix equations using a quantum computing system, and more particularly the present invention relates to a generalization of the Harrow/Hassidim/Lloyd algorithm which makes use of a quantum walk operator for the purposes of quantum phases estimation.

BACKGROUND

Matrix equation formulations are a powerful tool for the numerical analysis of physical systems, and their usage is widespread across many areas of engineering [1]-[3]. Unfortunately, the solution of practical matrix equations often demands an exorbitant supply of computational resources, with many present-day simulation problems already stressing the limits of available computing systems. For a matrix equation involving N unknowns, the most sophisticated algorithms of the current day provide

(N) or

(NpolylogN) runtime and memory complexity [4]-[6], and are heavily reliant on the structure of very specific problem classes. Thus, as simulations naturally grow more complex with time, the requisite computational power must grow at least proportionately.

For such computationally intensive problems, quantum computers are growing in popularity as a potential remedy, as they are capable of leveraging procedures of dramatically reduced complexity relative to their classical counterparts [7], [8], [11]. This is chiefly due to the manner in which quantum computers store and operate on data. Values of interest are stored as the amplitudes of possible states for a register of qubits, meaning that a 1-qubit system (using a 2-state qubit) can store two values using the amplitudes of the |0

and |1

states; a 2-qubit system can store four values using the |00

, |01

, |10

, and |11

states; and so on. In general, the storage capacity of a quantum computer scales exponentially with the size of the system. Quantum operators then act directly on the system's qubits, allowing the effects of operators to also scale exponentially with system size.

On the topic of matrix equation solvers, the Harrow/Hassidim/Lloyd (HHL) algorithm [9] has become well established as the leading quantum algorithm. For a system of condition number κ, this algorithm is capable of providing computational complexity

(κ² log(N)/ϵ) in the calculation of a solution of precision ϵ. Thus, when κ and 1/ϵ scale logarithmically with N, the procedure offers an exponential speedup over classical algorithms.

A detailed description of the HHL algorithm is given in the description below, but we provide a brief overview of the procedure here for the sake of motivation. In what follows, note that the notation |ν

indicates a vector ν with its components encoded onto the basis states of a quantum system as |ν

=Σ_(j=0) ^(N−1)ν_(j)|j

, where ν has N components. We typically suppress normalization factors where their meaning is irrelevant. For simplicity, |ν

is understood to also refer to the vector ν itself. We begin with a matrix equation A|x

=|b

, where A is an N×N matrix, and |x

and |b

are N-dimensional vectors. If a quantum system is initialized to the state |b

, then its state will be a superposition of the eigenvectors of A:

$\begin{matrix} {\left. {\left. {❘b} \right\rangle = {\sum\limits_{j = 0}^{N - 1}{\beta_{j}{❘u_{j}}}}} \right\rangle,} & (1) \end{matrix}$

where |u_(j)

is an eigenvector of A, and β_(j) is the component of |b

along |u_(j)

. The solution vector |x

can then be obtained by applying the inverse of each eigenvalue λ_(j) of A to its corresponding eigenvector in the superposition |b

:

$\begin{matrix} {\left. {\left. {\left. {\sum\limits_{j = 0}^{N - 1}{\frac{\beta_{j}}{\lambda_{j}}{❘u_{j}}}} \right\rangle = {A^{- 1}{❘b}}} \right\rangle = {❘x}} \right\rangle.} & (2) \end{matrix}$

This application of inverse eigenvalues, conditioned on the presence of the corresponding eigenvectors, is the basic function of HHL. By using quantum phase estimation (QPE) [10], it is possible to extract and apply these eigenvalue factors in an efficient manner. However, this phase estimation requires the implementation of a problem-dependent unitary in terms of basic quantum gates. Generally the unitary e^(iA) is employed for this purpose, but the process of decomposing this unitary into a sequence of basic quantum gates is nontrivial. Therefore the process of implementing this operation on real quantum hardware presents a bottleneck for the procedure.

SUMMARY OF THE INVENTION

In this work we consider a particular method, inspired by research into quantum walks, which produces a unitary with a known decomposition into basic gates.

According to one aspect of the invention there is provided a method of solving matrix equations using a quantum computing system, the method comprising:

-   -   (i) obtaining a matrix equation A|x         =|b         where A is an N×N system matrix and |x         and |b         are N-dimensional vectors;     -   (ii) expressing |b         as a superposition of eigenvectors of the system matrix A;     -   (iii) translating |b         to a superposition of eigenvectors of a unitary comprising a         quantum walk operator defined by reflections about a linear span         defined from A;     -   (iv) applying quantum phase estimation using said unitary to the         superposition of eigenvectors;     -   (v) applying the inverse of each eigenvalue of system matrix A         to its corresponding eigenvector in the translated         superposition;     -   (vi) uncomputing by applying inverse phase estimation and         eigenvector translation; and     -   (vii) extracting the solution |x         from a result of the previous steps.

The method may further comprise the quantum walk operator containing a reflection operator defined as 2TT^(†)−I, where application of T^(†) and T performs projection onto a vector space.

The method may further comprise defining:

$\left. {\left. {\left. {\left. {T = {\sum\limits_{j = 0}^{N - 1}\left( {❘{j,0}} \right.}} \right\rangle{❘\phi_{j}^{a}}} \right\rangle\left\langle {j,{0{❘{+ {❘{j,1}}}}}} \right\rangle{❘\zeta_{j}^{a}}} \right\rangle\left\langle {j,{1❘}} \right.} \right),$ where $\left. \left. {\left. {\left. {\left. {❘\phi_{j}^{a}} \right\rangle = {\frac{1}{\sqrt{N}}{\sum\limits_{k = 0}^{N - 1}{❘k}}}} \right\rangle\left\lbrack {\sqrt{\frac{N}{X}A_{jk}^{*}}{❘0}} \right.} \right\rangle + {\sqrt{1 - {\frac{N}{X}{❘A_{jk}❘}}}{❘1}}} \right\rangle \right\rbrack,$

and |ζ_(j) ^(a)

are arbitrary failure states.

The method may further comprise defining the quantum walk operator by the expression W=iS(2TT^(†)−I), where S is a register swap operation.

The method may further comprise, subsequent to quantum phase estimation, extracting eigenvalues Δ_(j) and applying ancilla rotation.

The method may further comprise performing initial translation of |b

to a superposition of eigenvectors of W by applying T, and performing uncomputation by applying T^(†).

The method may further comprise preventing negative elements from appearing on the diagonal of system matrix A by adding a constant multiple of the identity matrix.

Quantum computation offers a promising alternative to classical computing methods in many areas of numerical science, with algorithms that make use of the unique way in which quantum computers store and manipulate data often achieving dramatic improvements in performance over their classical counterparts. The potential efficiency of quantum computers is particularly important for numerical simulations, where the capabilities of classical computing systems are often insufficient for the analysis of real-world problems. In this work, we study problems involving the solution of matrix equations, for which there currently exists no efficient, general quantum procedure. We develop a generalization of the Harrow/Hassidim/Lloyd algorithm by providing an alternative unitary for eigenphase estimation. This unitary, which we have adopted from research in the area of quantum walks, has the advantage of being well defined for any arbitrary matrix equation, thereby allowing the solution procedure to be directly implemented on quantum hardware for any well-conditioned system. The procedure is most useful for sparse matrix equations, as it allows for the inverse of a matrix to be applied with

(N_(nz) log(N)) complexity, where N is the number of unknowns, and N_(nz) is the total number of nonzero elements in the system matrix. This efficiency is independent of the matrix structure, and hence the quantum procedure can outperform classical methods for many common system types. We show this using the example of sparse approximate inverse (SPAI) preconditioning, which involves the application of matrix inverses for matrices with N_(nz)=

(N). While these matrices are indeed sparse, it is often found that their inverses are quite dense, and classical methods can require as much as

(N³) time to apply an inverse preconditioner.

BRIEF DESCRIPTION OF THE DRAWINGS

One embodiment of the invention will now be described in conjunction with the accompanying drawings in which:

FIG. 1 is a diagram of quantum phase estimation. To emphasize the action of the eigenphase being read onto the phase register |p

, the vector register is shown to have the state of a single eigenvector. In general, it will be prepared in a superposition of all eigenvectors of U. In the state |ϕ_(j,a)

, the second subscript a indicates the a-th bit of the eigenphase ϕ_(j) corresponding to |u_(j)

. This final state assumes ϕ_(j) can be represented exactly by n_(p) bits. When ϕ_(j) cannot be represented thusly, the final state of the phase register will have probabilities which spike sharply in the vicinity of the most accurate approximation to ϕ_(j).

FIG. 2 is an illustration of the proportional presence of eigenphase estimations on the phase register after QPE. The unitary used for this calculation was the complex exponential e^(iH) of a randomly generated Hermitian matrix H, and the operand vector was also randomly generated. |B_(j)|² gives the theoretical probability associated with eigenvector |u_(j)

, and P(k) gives the measured probability of observing the phase register in state |k

. The amplitudes of phase states corresponding to accurate eigenphase approximations spike sharply and roughly in proportion to the presence of the eigenvectors, indicating that the state of a given phase estimate is entangled with the corresponding eigenstate. These spikes are not exactly proportional due to the probability being distributed over a nontrivial range of potential approximations.

FIG. 3 illustrates a control procedure summary for a 4-qubit control register and arbitrary operator U. This approach provides

(n) complexity for the implementation of an n-qubit control. This circuit is only applicable for a |1111

control state, but other controls can be easily implemented by applying Pauli X gates to qubits requiring a |0

control. Note that the actual application of U involves only a single control qubit, and hence the complexity of U does not compound with the control complexity.

FIG. 4 is a structural outline of the full procedure. Dashed boxes indicate the state of the system after every major intermediate stage. The |r₁

and |r₂

registers are the ancilla-augmented vector registers on which the walk operator and its associated constituents act. The phase register |p

provides space for the estimation of the eigenphases of W. The ancilla |a

is used for the application of the HHL rotation described in section II. We commonly refer to |a

as the “HHL ancilla” to distinguish it from the ancillae of |r₁

and |r₂

. The phase amplitudes ρ_(jk) ⁺ and ρ_(jk) ⁻ are used to distinguish the amplitudes of phase estimates corresponding to each of the two eigenvectors |ν_(j) ^(±)

. The eigenvalue estimates themselves require no such distinction, as both μ_(j) ⁺ and μ_(j)− have the same imaginary part.

FIG. 5 is a diagram of the initial application of T₀. Here state preparation operators are applied to |r₂

, conditioned on the state of |r₁

. Note that, due to the presumption that |r₁

is initially prepared with an ancilla state of |0

, the |r₁

ancilla is ignored in this calculation. Since the resulting system is highly entangled, individual qubit states cannot be separated. As a result, we have only provided a final state for the total system.

FIG. 6 : Diagram of the state preparation operator B_(j) applied to a register with all qubits initialized to the |0

state. Here θ_(jk)=arccos (√{square root over (|A_(jk)|N/X)}) and ω_(jk)=±arg(A_(jk))/2, where the positive solution for ω_(jk) is chosen iff arg(A_(jk))=η and j>k. Thus, the R_(y) gates rotate according to the magnitudes of the elements of A, with the factor of XPX subsequently enforcing the correct phase on the |0

state of the ancilla.

FIG. 7 is a diagram of the HHL rotation procedure. Here {tilde over (λ)}_(k)=X sin(2πk/N_(p))—d, and C is a lower bound on the magnitude of the {tilde over (λ)}_(k)'s that are not zero. Only those rotations for which {tilde over (λ)}_(k)≠0 should be applied.

FIG. 8 is a diagram of phase estimation using the walk operator. Here we use the same simplifications as in FIG. 1 .

FIG. 9 is a diagram of the walk operator W. Here S represents a one-to-one exchange of qubits states between |r₁

and |r₂

. The operator II can be applied to any qubit in |r₁

or |r₂

to produce the desired effect.

FIG. 10(a) and FIG. 10(b) illustrate gate counts and errors respectively for each circuit component in the solution procedure. Note that, due to the complex intermediate states, most gates are dedicated to component initializations.

FIG. 11 illustrate a solved charge distribution for a system with the left and right conductors held at potentials of 1.0V and −1.0V, respectively. Distances are shown in mm.

FIG. 12 illustrates a classically solved charge distribution. Distances are shown in mm.

FIG. 13(a) and FIG. 13(b) illustrate nonzeros in preconditioner P and P⁻¹, respectively.

FIG. 14 illustrates time to apply inverse preconditioner classically using GMRES.

FIG. 15(a) and FIG. 15(b) illustrate size in gates of quantum circuits, and corresponding time to compute respectively.

(N log N) line is shown for comparison.

FIG. 16 illustrates a simple extrapolation from computed data sets to estimate quantum/classical efficiency crossover.

(N log N) and

(N³) trend lines are used for the quantum and classical extrapolation, respectively.

FIG. 17 illustrates a two-dimensional reflection about the y-axis.

DETAILED DESCRIPTION I. Introduction

Quantum walks are a popular area of study in quantum computing, as they have shown success in aiding the construction of efficient algorithms [16]. Reference gives an excellent introduction to the concept of quantum walks. In essence, they are stochastic processes that, when evolved and measured, give information about the system in which they have evolved. The structure of the evolution and the properties measured can be adjusted to change the information obtained. We are interested in the walk procedure developed in [18], which considers the problem of element-distinctness. This problem is quite far removed from our current study, but it is important for the fact that it introduces a particular walk operator based on Grover diffusion operators. Following this research, further investigated diffusion-based quantum walks defined by probabilistic maps, and considered the spectra of the walk operators. Finally, expanded on these findings from the perspective of Hamiltonian simulation, and showed that the walk operators could be defined from a Hamiltonian to produce an operator with a spectrum closely related to that of the Hamiltonian itself. Reference further explored methods by which these walk operators could be implemented in practice.

The method developed in uses QPE to extract the eigenvalues of the walk operator, which can then be related to the eigenvalues of the Hamiltonian. This is the critical component from which we can develop a general procedure for solving matrix equations. By treating a Hermitian system matrix as the Hamiltonian, we can apply QPE using the walk operator to extract the eigenvalues of the system matrix. From there, the HHL algorithm can proceed as usual.

An algorithm presented in also makes use of the relationship between quantum walk operators and the eigenvalues of the system matrix (in particular, this work considers singular values) to produce an iterative quantum matrix solver. Our procedure differs in that it provides a direct solution method, is more easily generalizable, and does not require explicit computation of any singular values of the system matrix.

The matrix solution procedure we present here is particularly efficient for cases involving sparse matrices, wherein it can easily be seen to outperform classical solvers. This is due to the

(N_(nz) log N) gate complexity of the associated solution circuit, where N_(nz) is the total number of nonzero elements in the system matrix. When system matrices exhibit little reliable structure, it is often impossible for classical procedures to provide performance better than

(N³), regardless of the matrix sparsities. A key example of this is the technique of sparse approximate inverse (SPAI) preconditioning [20]-[22]. This technique typically generates a preconditioning matrix with

(N) nonzero elements, with a sparsity pattern that can be quite arbitrary, particularly for systems describing complex geometries. This lack of matrix structure makes the development of efficient, general classical solvers extremely difficult, and often impossible. However, our quantum method will always be capable of providing an inversion circuit having

(N log N) complexity (so long as the matrix is well-conditioned).

Using the Qiskit SDK [14], we have developed a program [15] which closely follows the herein described procedure. In the interest of expositional clarity, as well as to aid those seeking to investigate the program itself, we at times make reference to the specific functions of this program. At these points, the program is referred to simply as “the program”.

II. The HHL Algorithm

Here we describe the basic HHL algorithm which serves as a foundation for our matrix solution procedure. For brevity, we study only a primitive form of the HHL algorithm. More sophisticated formulations can be used to improve performance by, for example, ignoring ill-conditioned portions of the system matrix.

A. Initialization

Given a matrix A∈

^(N×N) and a vector |b

∈

^(N), the HHL algorithm is a quantum procedure to determine |x

such that

A|x

=|b

.  (3)

Due to the nature of quantum computation, several restrictive properties are required of this system. It is important to note, however, that all of these properties can be satisfied for any input system by means of a simple preparation procedure. Section V considers such preparation in depth. The restrictions are as follows: The vector |b

is to be encoded onto a quantum system, and as such we require that N be a power of two and that |b

be normalized. Additionally, we require that A is Hermitian. This ensures that its eigenvectors form a basis for

^(N) [26], and also aids us in the definition of the QPE unitary.

The first step of the HHL procedure is the preparation of three registers:

|b

|0

^(⊗n) ^(p) |0

.  (4)

The first register, which we refer to as the vector register, is initialized to |b

, and hence it requires n=log₂N qubits. The second register is an n_(p)-qubit phase register that is used to store the phase estimates produced by QPE. The value of n p is chosen by the user, and it should be large enough to admit sufficient resolution in the phase estimation. The final register is termed the ancilla register, and it consists of a single qubit. Once the eigenvalues of A have been estimated, the state of this register can be rotated to effect the application of the inverse eigenvalue factors.

The initial system state can be expressed in terms of the eigenvectors of A as

$\begin{matrix} {\left. {\left. {\left. {\left. {\left. {\left. {❘b} \right\rangle{❘0}} \right\rangle^{\otimes n_{p}}{❘0}} \right\rangle = {\sum\limits_{j = 0}^{N - 1}{\beta_{j}{❘u_{j}}}}} \right\rangle{❘0}} \right\rangle^{\otimes n_{p}}{❘0}} \right\rangle,} & (5) \end{matrix}$

where |u_(j)

is the j-th eigenvector of A, and β_(j) is the complex amplitude of |b

along |u_(j)

. The next step of the procedure is to apply QPE to this superposition of eigenvectors to determine the corresponding eigenphases.

B. Quantum Phase Estimation

Quantum phase estimation is a procedure for the estimation of the eigenphases of a unitary. It begins with the observation that the eigenvalues of unitary operators lie on the complex unit circle, and hence they can be expressed in the form

μ_(j) =e ^(2πiϕ) ^(j) ,  (6)

where μ_(j) is an eigenvalue of some unitary U, and φ_(j)∈[0,1) is termed the corresponding eigenphase. The fundamental action of QPE is to use one register, initialized to an eigenvector |u_(j)

of U, to write a binary representation of the corresponding eigenphase onto an external phase register:

$\begin{matrix} {\left. {\left. {\left. {\left. {❘u_{j}} \right\rangle{❘0}} \right\rangle^{\otimes n_{p}}\overset{QPE}{\mapsto}{❘u_{j}}} \right\rangle{❘{\overset{˜}{\phi}}_{j}}} \right\rangle.} & (7) \end{matrix}$

Here {tilde over (ϕ)}_(j) represents an n_(p)-bit approximation of ϕ_(j): If ϕ_(j) can be exactly represented by n_(p) bits, then the phase register will have the final state |ϕ_(j)

exactly. Note that ϕ_(j) is not, in general, an integer. The notation |ϕ_(j)

is used here simply as a label to indicate a precise eigenphase estimation. That is, |ϕ_(j)

is the state |k

such that k/2^(n) ^(p) =ϕ_(j). This notation follows naturally from (8). Otherwise, the state of the phase register will have maximal amplitude at the best n_(p)-bit approximation of ϕd_(j), with the amplitudes of its other basis states decaying rapidly in the vicinity of this best approximation. That is,

$\begin{matrix} {\left. {\left. {❘{\overset{˜}{\phi}}_{j}} \right\rangle = {\sum\limits_{k = 0}^{2^{n_{p}} - 1}{\rho_{jk}{❘k}}}} \right\rangle.} & (8) \end{matrix}$

Where ρ_(jk) spikes sharply in the vicinity of states with k/2^(n) ^(p) ≈ϕ_(j). We do not explore the specifics of the QPE procedure here, but a summary diagram is given in FIG. 1 .

Since QPE is itself a linear operator, its effect when applied to a superposition of eigenvectors of U is as follows:

$\begin{matrix} {\left. {\left. {\left. {\left. {\sum\limits_{j = 0}^{N - 1}{\beta_{j}{❘u_{j}}}} \right\rangle{❘0}} \right\rangle^{\otimes n_{p}}\overset{QPE}{\mapsto}{\sum\limits_{j = 0}^{N - 1}{\beta_{j}{❘u_{j}}}}} \right\rangle{❘{\overset{˜}{\phi}}_{j}}} \right\rangle.} & (9) \end{matrix}$

That is, the approximated eigenphase states appear on the phase register entangled with their corresponding eigenvectors. FIG. 2 provides an illustration of this behavior.

In the case of our current system, we require a unitary with eigenvalues and eigenvectors which can be easily related to those of A. For the purposes of the HHL algorithm, the QPE unitary is typically defined as the exponential of the system matrix [27],

U=e ^(iAt),  (10)

where t is some constant. This operator is useful due to the close relationships between its eigenvalues and eigenvectors, and those of A. However, it is interesting to note that this operator also corresponds to the simulation of a physical system subjected to a process described by the Hamiltonian A. The evolution of such a system is given by Schrodinger's” equation:

$\begin{matrix} {\left. {{i\hslash\frac{\left. {\partial{❘\psi}} \right\rangle}{\partial t}} = {A{❘\psi}}} \right\rangle.} & (11) \end{matrix}$

When evolved from an initial state |ψ(0)

for a time t, the system's final state is given by

|ψ(t)

=e ^(−iAt/h)|ψ(0)

.  (12)

Thus, the operator in (10) can be considered to be a time evolution operator for the Hamiltonian A, up to the factor of −1/h.

Different values of t, and even combinations of different values, can be used to improve the performance of the calculation, but from this point on we will use t=1 for notational convenience. Then the unitary U=e^(iAt) has eigenvalues e^(iλ) ^(j) , and hence the eigenvalues of A are related to the eigenphases of U by

e ^(iA) ^(j) =e ^(2πiϕ) ^(j) ⇒A _(j)=2πϕ_(j)+2πl,  (13)

for some integer 1. Recall that ϕ_(j) is on the range [0,1). If we assume that A has eigenvalues on the range [−π, π] (this can be achieved in general by a simple rescaling of the system matrix) then we see that

$\phi_{j} \in \left\lbrack {0,\frac{1}{2}} \right\rbrack$

correspond to λ_(j)∈[0,π], and

$\phi_{j} \in \left( {\frac{1}{2},1} \right)$

correspond to λ_(j)∈(−π, 0). Thus, λ_(j) can be computed as

$\begin{matrix} {\lambda_{j} = \left\{ \begin{matrix} {{2\pi\phi_{j}},} & {\phi_{j} \in \left\lbrack {0,\frac{1}{2}} \right\rbrack} \\ {{2{\pi\left( {\phi_{j} - 1} \right)}},} & {\phi_{j} \in {\left( {\frac{1}{2},1} \right).}} \end{matrix} \right.} & (14) \end{matrix}$

Of course, we do not compute the eigenphases exactly. Instead, we transform the phase register to some superposition where the amplitude of a basis state |k

grows large when k/N_(p)≈ϕ_(j). Here we have defined N_(p)=2^(n) ^(p) . Then we in fact need to calculate potential approximations of the eigenvalues as state is

$\begin{matrix} {{\overset{\sim}{\lambda}}_{k} = \left\{ \begin{matrix} {{2\pi\frac{k}{N_{p}}},} & {k \leq \frac{N_{p}}{2}} \\ {{2{\pi\left( {\frac{k}{N_{p}} - 1} \right)}},} & {k > {\frac{N_{p}}{2}.}} \end{matrix} \right.} & (15) \end{matrix}$

From the above descriptions, we see that the effect of QPE on the current system

$\begin{matrix} {\left. {\left. {\left. {\left. {\left. {\left. {\sum\limits_{j = 0}^{N - 1}{\beta_{j}{❘u_{j}}}} \right\rangle{❘0}} \right\rangle^{\otimes n_{p}}{❘0}} \right\rangle\overset{QPE}{\mapsto}{\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N_{P} - 1}{\beta_{j}\rho_{jk}{❘u_{j}}}}}} \right\rangle{❘k}} \right\rangle{❘0}} \right\rangle,} & (16) \end{matrix}$

where ρ_(jk) is the amplitude of the phase state |k

resulting from the action of QPE on eigenvector |u_(j)

. Thus, ρ_(jk) should spike sharply when |k

nears an accurate approximation of the j-th eigenphase of U, and remain near zero otherwise. With the eigenvalue extraction procedure defined, we can apply the third step of the procedure: ancilla rotation.

C. Ancilla Rotation and Uncomputation

In this step, the ancilla register is used to impose the inverse eigenvalue factors on the system. We use the rotation operator

$\begin{matrix} {\left. {\left. {\left. {{R_{y}\left( {2{\arccos\left( \frac{C}{{\overset{˜}{\lambda}}_{k}} \right)}} \right)}{❘0}} \right\rangle = {\frac{C}{{\overset{˜}{\lambda}}_{k}}{❘0}}} \right\rangle + {\sqrt{1 - \frac{C^{2}}{{\overset{˜}{\lambda}}_{k}^{2}}}{❘1}}} \right\rangle,} & (17) \end{matrix}$

where C is a constant chosen to ensure that all arguments of the arccos function obey its domain restrictions. We recommend C=2π/N_(p), as this corresponds to the minimum possible magnitude of the denominator {tilde over (λ)}_(k) in (15), excepting k=0. The k=0 case should be explicitly omitted from the calculation, as a nontrivial contribution from this state would indicate an eigenvalue near zero, and therefore an ill-conditioned matrix. By using a controlled version of this rotation operator, with the phase register acting as the control register, it is possible to entangle the {tilde over (λ)}_(k) rotation with the |k

state of the phase register. Applying this controlled rotation to the ancilla register for all k∈{1, . . . , N_(p)−1}, the system is transformed to the state

$\begin{matrix} {\left. \left. {\left. {\left. {\left. {\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 1}^{N_{p} - 1}{\beta_{j}\rho_{jk}{❘u_{j}}}}} \right\rangle{❘k}} \right\rangle\left( {\frac{C}{{\overset{˜}{\lambda}}_{k}}{❘0}} \right.} \right\rangle + {\sqrt{1 - \frac{C^{2}}{{\overset{˜}{\lambda}}_{k}^{2}}}{❘1}}} \right\rangle \right),} & (18) \end{matrix}$

where we have omitted the k=0 case on the assumption that ρ_(j0)≈0.

Note that the state (18) is approximately the following ideal state:

$\begin{matrix} {\left. \left. {\left. {\left. {\left. {\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N_{p} - 1}{\beta_{j}\rho_{jk}{❘u_{j}}}}} \right\rangle{❘k}} \right\rangle\left( {\frac{C}{\lambda_{j}}{❘0}} \right.} \right\rangle + 1 - {\frac{C^{2}}{\lambda_{j}^{2}}{❘1}}} \right\rangle \right).} & (19) \end{matrix}$

This is true since p jk spikes sharply when {tilde over (λ)}_(k) approaches λ_(j), with the spike narrowing as more accurate approximations become available. Then terms with {tilde over (λ)}_(k) not approximately equal to λ_(j) are nullified by their corresponding coefficients ρ_(jk) approaching zero, and we can, up to an approximation error, replace {tilde over (λ)}_(k) with λ_(j), as we have done in (19). With the knowledge that the QPE error is obscured by this step, we from this point on assume that the system is in state (19) exactly. Acting on this state with an inverse QPE will then “uncompute” the phase register, leaving us in the state

$\begin{matrix} {\left. \left. {\left. {\left. {\left. {\sum\limits_{j = 0}^{N - 1}{\beta_{j}{❘u_{j}}}} \right\rangle{❘0}} \right\rangle^{\otimes n_{p}}\left( {\frac{C}{\lambda_{j}}{❘0}} \right.} \right\rangle{+ \sqrt{1 - \frac{C^{2}}{\lambda_{j}^{2}}}}{❘1}} \right\rangle \right).} & (20) \end{matrix}$

This is the final state of the system, from which our solution can be extracted. Selecting those states with 10) in all qubits of the phase register and the ancilla register, we have

$\begin{matrix} {\left. {C{\sum\limits_{j = 0}^{N - 1}{\frac{\beta_{j}}{\lambda_{j}}{❘u_{j}}}}} \right\rangle.} & (21) \end{matrix}$

This state, when divided by C, is exactly the decomposition of A⁻¹|b

in terms of the eigenvectors of A, and hence (21) gives our final solution |x

.

III. The Walk Operator

A walk operator is a unitary operator that is used during a quantum walk procedure, with each application of the operator representing a “step” made by the system. As mentioned above, we do not here describe a quantum walk procedure per se. Rather, we simply adopt a walk operator from a formerly studied quantum walk procedure [18], [19]. The operator chosen is useful because its implementation is well defined for any arbitrary system matrix.

The walk operator itself has several constituents which must be defined before the operator can be stated succinctly. To begin, we define the vectors

$\begin{matrix} {{\left. {\left. {❘\phi_{j}} \right\rangle = {\frac{1}{\sqrt{N}}{\sum\limits_{k = 0}^{N - 1}{❘k}}}} \right\rangle\sqrt{\frac{N}{X}A_{jk}^{*}}},} & (22) \end{matrix}$

for j∈{0, . . . , N−1}. Here X is a constant which must satisfy X≤N|A_(jk)|_(max), where |A_(jk)|_(max)=max_(j,k)(|A_(jk)|). This factor is required for the purposes of ancilla rotation, as discussed in section IV. The |ϕ_(j)

vectors are useful to us as carriers of information about the system matrix, and they form foundational elements of the walk operator. However, they are possessed of some critical shortcomings. First, they are not normalized. While they could be explicitly normalized through appropriate j-dependent factors, subsequent derivations serve to show that this scheme would destroy crucial operator properties. In particular, the result of (34) would no longer hold. The second concern regarding the |φ_(j)

vectors is their preparation. Producing unitary operators to generate these states is a nontrivial problem, and even once computed, these operators would also carry j-dependent normalization factors.

Both of these shortcomings can be remedied with relative ease by introducing an ancillary qubit and studying the set of augmented states

$\begin{matrix} {\left. \left. {\left. {\left. {\left. {❘\phi_{j}^{a}} \right\rangle = {\frac{1}{\sqrt{N}}{\sum\limits_{k = 0}^{N - 1}{❘k}}}} \right\rangle\left\lbrack {\sqrt{\frac{N}{X}A_{jk}^{*}}{❘0}} \right.} \right\rangle + {\sqrt{\left. {1 - {\frac{N}{X}{❘A_{jk}}}} \right\rangle}{❘1}}} \right\rangle \right\rbrack.} & (23) \end{matrix}$

These states are normalized, and they can be easily produced through unitary transformations (see section IV). Note that the |φ_(j)

states appear when the ancilla is in the |ϕ

state. Hence, the |1

state of the ancilla can be interpreted as a failure state.

Storage of each |ϕ_(j) ^(a)) state requires an (n+1)-qubit register. We define two such registers, and refer to them by the names |r₁

and |r₂

. The ancilla-augmented basis states for these registers are indicated by a superscript α, e.g. |j^(a)). Note that there are 2^(n+1)=2N augmented basis states. When necessary, we always assume that the ancillary qubit is appended to the relevant register. In this procedure, there are two basic operators which act on these registers. The first is the swap operator, which swaps the content of |r₁

and |r₂

:

$\begin{matrix} {{{{{\left. {\left. {S = {\sum\limits_{j^{a} = 0}^{{2N} - 1}{\sum\limits_{k^{a} = 0}^{{2N} - 1}{❘k^{a}}}}} \right\rangle{❘j^{a}}} \right\rangle\left\langle j^{a} \right.}❘}\left\langle k^{a} \right.}❘}.} & (24) \end{matrix}$

The second operator is that which produces |ϕ_(j) ^(a)

on |r₂

when |r₁

is in the state |j

with ancilla state |0

:

$\begin{matrix} {\left. {{\left. {\left. {{{\left. {\left. {T = {\sum\limits_{j = 0}^{N - 1}\left( {❘{j,0}} \right.}} \right\rangle{❘\phi_{j}^{a}}} \right\rangle\left\langle {j,0} \right.}❘} + {❘{j,1}}} \right\rangle{❘\zeta_{j}^{a}}} \right\rangle\left\langle {j,1} \right.}❘} \right).} & (25) \end{matrix}$

Here the |ζ_(j) ^(a)

states correspond to failure states. A forthcoming analysis of the T^(†)ST operator shows that they must have ancilla state |1

, but otherwise their definition is insignificant. These are proper quantum states, and hence they must be normalized.

These prerequisites are sufficient for us to state the walk operator:

W=iS(2TT ^(†) −I).  (26)

The process of implementing W is further explored in section IV. For the remainder of this section, we take it as given that W can be implemented. As stated above, this walk operator is particularly interesting to us because it has eigenvalues and eigenvectors closely related to those of A itself. In deriving these relationships between W and A, we first calculate some useful relationships for the constituent operators T and S. To begin, consider the product T^(†)T:

$\begin{matrix} {\begin{matrix} {\left. \left. {{{{\left. {{{{{\left. {{T^{\dagger}T} = \left\lbrack {\sum\limits_{j = 0}^{N - 1}\left( {❘{j,0}} \right.} \right.} \right\rangle\left\langle {j,0} \right.}❘}\left\langle \phi_{j}^{a} \right.}❘} + {❘{j,1}}} \right\rangle\left\langle {j,1} \right.}❘}\left\langle \zeta_{j}^{a} \right.}❘} \right) \right\rbrack \cdot} \\ \left. \left. {{\left. {\left. {{{\left. {\left. {}\left\lbrack {\sum\limits_{k = 0}^{N - 1}\left( {❘{k,0}} \right.} \right. \right\rangle{❘\phi_{k}^{a}}} \right\rangle\left\langle {k,0} \right.}❘} + {❘{k,1}}} \right\rangle{❘\zeta_{k}^{a}}} \right\rangle\left\langle {k,1} \right.}❘} \right) \right\rbrack \\ {{{\left. {= {\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N - 1}{❘{j,0}}}}} \right\rangle\left\langle {\phi_{j}^{a}❘\phi_{k}^{a}} \right\rangle\left\langle {j,{0❘k},0} \right\rangle\left\langle {k,0} \right.}❘} +} \\ {{\left. {}{❘{j,1}} \right\rangle\left\langle {\zeta_{j}^{a}❘\zeta_{k}^{a}} \right\rangle\left\langle {j,{1❘k},1} \right\rangle\left\langle {k,1} \right.}❘} \end{matrix}.} & (27) \end{matrix}$

Recalling that the |ϕ_(j) ^(a)) and |ζ_(j) ^(a)) states are normalized and that the basis states are orthonormal, we have

$\begin{matrix} {\left. {{\left. {{{\left. {{T^{\dagger}T} = {\sum\limits_{j = 0}^{N - 1}\left( {❘{j,0}} \right.}} \right\rangle\left\langle {j,0} \right.}❘} + {❘{j,1}}} \right\rangle\left\langle {j,1} \right.}❘} \right) = {I.}} & (28) \end{matrix}$

Note that despite the above, TT^(†) does not yield the identity operator, and hence T is not a unitary transformation as currently stated. The second relationship of interest is the following:

$\begin{matrix} {\begin{matrix} {\left. \left. {{{{\left. {{{{{\left. {{T^{\dagger}{ST}} = \left\lbrack {\sum\limits_{j = 0}^{N - 1}\left( {❘{j,0}} \right.} \right.} \right\rangle\left\langle {j,0} \right.}❘}\left\langle \phi_{j}^{a} \right.}❘} + {❘{j,a}}} \right\rangle\left\langle {j,1} \right.}❘}\left\langle \zeta_{j}^{a} \right.}❘} \right) \right\rbrack \cdot} \\ \left. \left. {{\left. {\left. {{{\left. {\left. {}\left\lbrack {\sum\limits_{k = 0}^{N - 1}\left( {❘\phi_{k}^{a}} \right.} \right. \right\rangle{❘{k,0}}} \right\rangle\left\langle {k,0} \right.}❘} + {❘\zeta_{k}^{a}}} \right\rangle{❘{k,1}}} \right\rangle\left\langle {k,1} \right.}❘} \right) \right\rbrack \\ {{{\left. {= {\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N - 1}\left( {❘{j,0}} \right.}}} \right\rangle\left\langle {{\phi_{j}^{a}❘k},0} \right\rangle\left\langle {j,{0❘\phi_{k}^{a}}} \right\rangle\left\langle {k,0} \right.}❘} +} \\ {{{\left. {}{❘{j,0}} \right\rangle\left\langle {{\phi_{j}^{a}❘k},1} \right\rangle\left\langle {j,{0❘\zeta_{k}^{a}}} \right\rangle\left\langle {k,1} \right.}❘} +} \\ {{{\left. {}{❘{j,1}} \right\rangle\left\langle {{\zeta_{j}^{a}❘k},0} \right\rangle\left\langle {j,{1❘\phi_{k}^{a}}} \right\rangle\left\langle {k,0} \right.}❘} +} \\ \left. {{\left. {}{❘{j,1}} \right\rangle\left\langle {{\zeta_{j}^{a}❘k},1} \right\rangle\left\langle {j,{1❘\zeta_{k}^{a}}} \right\rangle\left\langle {k,1} \right.}❘} \right) \end{matrix}.} & (29) \end{matrix}$

If this operator acts on an arbitrary input vector |ψ, 0

, we have

$\begin{matrix} {{\left. {\left. {T^{\dagger}{ST}{❘{\psi,0}}} \right\rangle = {\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N - 1}\left( {❘{j,0}} \right.}}} \right\rangle\left\langle {{\phi_{j}^{a}❘k},0} \right\rangle\left\langle {j,{0❘\phi_{k}^{a}}} \right\rangle\left\langle {k,{0❘\psi},0} \right\rangle} +} & (30) \end{matrix}$ ❘j, 1⟩⟨ζ_(j)^(a)❘k, 0⟩⟨j, 1❘ϕ_(k)^(a)⟩⟨k, 0❘ψ, 0⟩).

If each |ζ_(j) ^(a)) has ancilla state |1

, this expression becomes

$\begin{matrix} {\left. {\left. {T^{\dagger}{ST}{❘{\psi,0}}} \right\rangle = {\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N - 1}{❘{j,0}}}}} \right\rangle\left\langle {{\phi_{j}^{a}❘k},0} \right\rangle\left\langle {j,{0❘\phi_{k}^{a}}} \right\rangle{\left\langle {k,{0❘\psi},0} \right\rangle.}} & (31) \end{matrix}$

This elimination of the |ζ_(j) ^(a)) contributions is a crucial result, and hence we require that these states have ancilla state |1

. The inner products are

$\begin{matrix} {{{{{\left\langle {{\phi_{j}^{a}❘k},0} \right\rangle = \left\lbrack {\frac{1}{\sqrt{N}}{\sum\limits_{p = 0}^{N - 1}\left\langle p \right.}} \right.}❘}\left( {\sqrt{\frac{N}{X}}\left( \sqrt{A_{jp}^{*}} \right)^{*}\left\langle 0 \right.} \right.}❘} +} & (32) \end{matrix}$ ${\left. {\left. {\left. \left. {{\sqrt{1 - {\frac{N}{X}{❘A_{jp}❘}}}\left\langle 1 \right.}❘} \right) \right\rbrack{❘k}} \right\rangle{❘0}} \right\rangle = \left( \sqrt{\frac{A_{jk}^{*}}{X}} \right)^{*}},$ $\begin{matrix} {\left. \left. \left. {\left. {\left. {{{{{\left\langle {j,{0❘\phi_{k}^{a}}} \right\rangle = \left\langle j \right.}❘}\left\langle 0 \right.}❘}\left\lbrack {\frac{1}{\sqrt{N}}{\sum\limits_{p = 0}^{N - 1}{❘p}}} \right.} \right\rangle\left( {\sqrt{\frac{N}{X}A_{kp}^{*}}{❘0}} \right.} \right\rangle + {\sqrt{1 - {\frac{N}{X}{❘A_{kp}❘}}}{❘1}}} \right\rangle \right) \right\rbrack = {\sqrt{\frac{A_{kj}^{*}}{X}}.}} & (33) \end{matrix}$

Then we have

$\begin{matrix} {\begin{matrix} {{\left. {\left. {T^{\dagger}{ST}{❘{\psi,0}}} \right\rangle = {\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N - 1}{❘{j,0}}}}} \right\rangle\sqrt{\frac{A_{kj}^{*}}{X}}\left( \sqrt{\frac{A_{jk}^{*}}{X}} \right)^{*}\left\langle {k,{0❘\psi},0} \right\rangle} =} \\ {\left. {}{\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N - 1}{❘{j,0}}}} \right\rangle\frac{A_{jk}}{X}\left\langle {k,{0❘\psi},0} \right\rangle} \\ \left. {\left. \left. {= \left( {\frac{1}{X}A{❘\psi}} \right.} \right\rangle \right){❘0}} \right\rangle \end{matrix}.} & (34) \end{matrix}$

The statement that √{square root over (A_(kj)*)}(√{square root over (A_(jk)*)})*=A_(jk) is true, but it presents an issue for implementation when A_(jk) lies on the negative real axis. This problem is further discussed in section IV. By the above, we see that T^(†)ST, when applied to a vector with ancilla state |0

, acts as a rescaled version of A. We introduce the shorthand

$\begin{matrix} {{{\left. {\hat{A} \equiv {\frac{1}{X}{\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N - 1}{A_{jk}{❘{j,0}}}}}}} \right\rangle\left\langle {k,0} \right.}❘}.} & (35) \end{matrix}$

This transformation is a 2N×2N matrix, and it can therefore be applied directly to the 2N-dimensional augmented states. This simplifies the statement of (34):

T ^(†) ST|ψ,0

=A|ψ,0

.  (36)

Now we can begin the analysis of the walk operator's eigenvalues and eigenvectors. We begin with the assertion that the eigenvalues of Â must lie on the range [−1,1]. By the definition of X, this is in fact always satisfied regardless of the choice of A, as we show in section V. With this established, consider now the effect of applying W to the vector T|u_(j) ^(a)

=T|u_(j), 0) (recall that |u_(j)

is an eigenvector of A):

WT|u _(j) ^(a)

=iST|u _(j) ^(a)

  (37)

Note that we have continued to assume that the input vector is provided with ancilla state |0

. Meanwhile, if W is applied to ST|u_(j) ^(a)

, we obtain

WST|u _(j) ^(a)

=2i{circumflex over (λ)} _(j) ST|u _(j) ^(a)

−iT|u _(j) ^(a)

,  (38)

where {circumflex over (λ)}_(j)=A_(j)/X is the eigenvalue of A corresponding to |u_(j) ^(a)). Thus, if W is applied to any superposition of T|u_(j) ^(a)

and ST|u_(j) ^(a)

, the result will be a simple superposition of the same two vectors:

W(T|u _(j) ^(a)

+γST|u _(j) ^(a)

=−iγT|u _(j) ^(a)

+i(1+2{circumflex over (λ)}_(j)γ)ST|u _(j) ^(a)

,  (39)

where γ is an arbitrary factor for the relative phase and magnitude of the two contributions. Then (T|u_(j) ^(a)

+γST|u_(j) ^(a)

) is an eigenvector |ν_(j)

of W, with eigenvalue μ_(j), if γ=iμ_(j) and iμ² _(j)=i(1+2{circumflex over (λ)}_(j)γ). Solving this expression for the eigenvalues, we find two solutions:

μ_(j) ^(±) =i{circumflex over (λ)} _(j)±√{square root over (1−{circumflex over (λ)}_(j) ²)}.  (40)

The eigenvectors |ν_(j) ^(±)) corresponding to these eigenvalues can be normalized by computing the inner products of their unnormalized counterparts:

$\begin{matrix} {\begin{matrix} \left. \left. {{\left. {\left\langle {v_{j}^{\pm}❘v_{j}^{\pm}} \right\rangle = {\left( \left\langle {u_{j}^{a}❘{T^{\dagger} - {{i\left( \mu_{j}^{\pm} \right)}^{*}\left\langle {u_{j}^{a}❘{T^{\dagger}S^{\dagger}}} \right.}}} \right. \right)\left( {T❘u_{j}^{a}} \right.}} \right\rangle + {i\mu_{j}^{\pm}{ST}}}❘u_{j}^{a}} \right\rangle \right) \\ {\left. {= {\left\langle {u_{j}^{a}{❘{T^{\dagger}T}❘}u_{j}^{a}} \right\rangle + {i\mu_{j}^{\pm}{❘{T^{\dagger}{ST}}❘}u_{j}^{a}}}} \right\rangle - {{i\left( \mu_{j}^{\pm} \right)}^{*}\left\langle {u_{j}^{a}{❘{T^{\dagger}S^{\dagger}T}❘}u_{j}^{a}} \right\rangle} +} \\ {{❘\mu_{j}^{\pm}❘}^{2}\left\langle {u_{j}^{a}{❘{T^{\dagger}S^{\dagger}{ST}}❘}u_{j}^{a}} \right\rangle} \\ {= {\left\langle {u_{j}^{a}❘u_{j}^{a}} \right\rangle + {i\mu_{j}^{\pm}\left\langle {u_{j}^{a}{❘\hat{A}❘}u_{j}^{a}} \right\rangle} - {{i\left( \mu_{j}^{\pm} \right)}^{*}\left\langle {u_{j}^{a}{❘{\hat{A}}^{\dagger}❘}u_{j}^{a}} \right\rangle} + {{❘\mu_{j}^{\pm}❘}^{2}\left\langle {u_{j}^{a}❘u_{j}^{a}} \right\rangle}}} \\ {= {1 + {i\mu_{j}^{\pm}{\hat{\lambda}}_{j}} - {{i\left( \mu_{j}^{\pm} \right)}^{*}{\hat{\lambda}}_{j}} + 1}} \\ {= {2\left( {1 - {\hat{\lambda}}_{j}^{2}} \right)}} \end{matrix}.} & (41) \end{matrix}$

Therefore, W has the normalized eigenvectors

$\begin{matrix} {\left. {\left. {❘v_{j}^{\pm}} \right\rangle = {\frac{1 + {i\mu_{j}^{\pm}S}}{\sqrt{2\left( {1 - {\hat{\lambda}}_{j}^{2}} \right)}}T{❘u_{j}^{a}}}} \right\rangle.} & (42) \end{matrix}$

While the above analysis does not constitute a comprehensive investigation into the eigenvalues and eigenvectors of W, this simplified derivation is, as shown in what follows, sufficient for our purposes. For a detailed analysis, see [19]. To demonstrate the sufficiency of the above analysis, consider the following superposition of eigenvectors of W:

$\begin{matrix} {\frac{\left. {\left. {\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{-}}} \right){❘v_{j}^{+}}} \right\rangle + {\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{+}}} \right){❘v_{j}^{-}}}} \right\rangle}{\sqrt{2\left( {1 - {\hat{\lambda}}_{j}^{2}} \right)}}.} & (43) \end{matrix}$

Expanding the eigenvector expressions and simplifying, we find

$\begin{matrix} {\begin{matrix} {\begin{matrix} {\left. {\frac{1}{2\left( {1 - {\hat{\lambda}}_{j}^{2}} \right)}\left\lbrack {\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{-}}} \right)\left( {1 + {i\mu_{j}^{+}S}} \right)T{❘u_{j}^{a}}} \right.} \right\rangle +} \\ \left. \left. {\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{+}}} \right)\left( {1 + {i\mu_{j}^{-}S}} \right)T{❘u_{j}^{a}}} \right\rangle \right\rbrack \end{matrix} = {\frac{1}{2\left( {1 - {\hat{\lambda}}_{j}^{2}} \right)}\left\lbrack {2 + {i\left( {\mu_{j}^{+} +} \right.}} \right.}} \\ {{\left. {}\mu_{j}^{-} \right)S} + {i{{\hat{\lambda}}_{j}\left( {\mu_{j}^{+} + \mu_{j}^{-}} \right)}} -} \\ \left. {\left. {}{2{\hat{\lambda}}_{j}\mu_{j}^{+}\mu_{j}^{-}S} \right\rbrack T{❘u_{j}^{a}}} \right\rangle \\ {= {\frac{1}{2\left( {1 - {\hat{\lambda}}_{j}^{2}} \right)}\left\lbrack {2 - {2{\hat{\lambda}}_{j}S} -} \right.}} \\ \left. {\left. {}{{2{\hat{\lambda}}_{j}^{2}} + {2{\hat{\lambda}}_{j}S}} \right\rbrack T{❘u_{j}^{a}}} \right\rangle \\ \left. {= {T{❘u_{j}^{a}}}} \right\rangle \end{matrix}.} & (44) \end{matrix}$

This result gives us the necessary components to build a matrix equation solver. By applying T to the initial right-hand side vector |b, 0

we can transform the vector into a predictable superposition of the |ν_(j) ^(±)

'S:

$\begin{matrix} {\left. \left. {\left. {\left. {\left. {T{❘{b,0}}} \right\rangle = {\sum\limits_{j = 0}^{N - 1}{\beta_{j}T{❘u_{j}^{a}}}}} \right\rangle = {\sum\limits_{j = 0}^{N - 1}{\frac{\beta_{j}}{\sqrt{2\left( {1 - {\hat{\lambda}}_{j}^{2}} \right)}}\left\lbrack {\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{-}}} \right){❘v_{j}^{+}}} \right.}}} \right\rangle + {\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{+}}} \right){❘v_{j}^{-}}}} \right\rangle \right\rbrack.} & (45) \end{matrix}$

Then an application of QPE to this state using W as the requisite unitary yields the phase corresponding to μ_(j) ⁺; or μ_(j) ⁻ when |u_(j) ^(a)

appears in the initial state. From here it is possible to extract λ_(j) and apply an HHL-style ancilla rotation. After applying inverse QPE, the final step of the procedure is to uncompute by applying T^(†), thereby leaving only the rotated initial state, as in the result of HHL.

IV. Considerations for Practical Implementation

The analysis we have provided so far represents a complete theoretical formulation of the procedure, but practical implementation presents several nontrivial problems. In particular, the implementation of W, the initial application of T, and the eigenvalue extraction require elaboration. Here we present a recommended approach to the resolution of these sticking points.

Implementation of W requires, in addition to the straightforward operators i and S, the more involved operator 2TT^(†)−I. This operator is a sum of conditional reflectors about the |ϕ_(j) ^(a)

and |ζ_(j) ^(a)

states, as the following calculation shows. A brief introduction to the concept of reflectors is given in the section below under the heading “IX. Reflection Operators”. We begin by expanding and simplifying the TT^(†) portion of the operator:

$\begin{matrix} {\begin{matrix} {\left. \left. {{\left. {\left. {{{\left. {\left. {{TT}^{\dagger} = \left\lbrack {\sum\limits_{j = 0}^{N - 1}\left( {❘{j,0}} \right.} \right.} \right\rangle{❘\phi_{j}^{a}}} \right\rangle\left\langle {j,0} \right.}❘} + {❘{j,1}}} \right\rangle{❘\zeta_{j}^{a}}} \right\rangle\left\langle {j,1} \right.}❘} \right) \right\rbrack \cdot} \\ \left. \left. {{{{\left. {{{{{\left. {}\left\lbrack {\sum\limits_{k = 0}^{N - 1}\left( {❘{k,0}} \right.} \right. \right\rangle\left\langle {k,0} \right.}❘}\left\langle \phi_{k}^{a} \right.}❘} + {❘{k,1}}} \right\rangle\left\langle {k,1} \right.}❘}\left\langle \zeta_{k}^{a} \right.}❘} \right) \right\rbrack \\ {\left. {{\left. {{{\left. {= {\overset{N - 1}{\sum\limits_{j = 0}}{\sum\limits_{k = 0}^{N - 1}\left\lbrack {\left\langle {j,{0❘k},0} \right\rangle\left( {❘{j,0}} \right.} \right.}}} \right\rangle\left\langle {k,0} \right.}❘} \otimes {❘\phi_{j}^{a}}} \right\rangle\left\langle \phi_{k}^{a} \right.}❘} \right) +} \\ \left. \left. {{\left. {{{\left. {}{\left\langle {j,{1❘k},1} \right\rangle\left( {❘{j,1}} \right.} \right\rangle\left\langle {k,1} \right.}❘} \otimes {❘\zeta_{j}^{a}}} \right\rangle\left\langle \zeta_{k}^{a} \right.}❘} \right) \right\rbrack \\ \left. {{\left. {{{\left. {{{\left. {{{\left. {= {\sum\limits_{j = 0}^{N - 1}\left( {❘{j,0}} \right.}} \right\rangle\left\langle {j,0} \right.}❘} \otimes {❘\phi_{j}^{a}}} \right\rangle\left\langle \phi_{j}^{a} \right.}❘} + {❘{j,1}}} \right\rangle\left\langle {j,1} \right.}❘} \otimes {❘\zeta_{j}^{a}}} \right\rangle\left\langle \zeta_{j}^{a} \right.}❘} \right) \end{matrix}.} & (46) \end{matrix}$

Then the full operator 2TT^(†)−I is

$\begin{matrix} {\left. {{\left. {{{\left. {{{\left. {{{\left. {2{\sum\limits_{j = 0}^{N - 1}\left( {❘{j,0}} \right.}} \right\rangle\left\langle {j,0} \right.}❘} \otimes {❘\phi_{j}^{a}}} \right\rangle\left\langle \phi_{j}^{a} \right.}❘} + {❘{j,1}}} \right\rangle\left\langle {j,1} \right.}❘} \otimes {❘\zeta_{j}^{a}}} \right\rangle\left\langle \zeta_{j}^{a} \right.}❘} \right) -} & (47) \end{matrix}$ $\left. {{{\left. {{{\left. {\left. {{{\left. {{{{\left. {\sum\limits_{j = 0}^{N - 1}\left( {❘{j,0}} \right.} \right\rangle\left\langle {j,0} \right.}❘} \otimes I} + {❘{j,1}}} \right\rangle\left\langle {j,1} \right.}❘} \otimes I} \right) = {\sum\limits_{j = 0}^{N - 1}\left\lbrack {❘{j,0}} \right.}} \right\rangle\left\langle {j,0} \right.}❘} \otimes \left( {2{❘\phi_{j}^{a}}} \right.} \right\rangle\left\langle \phi_{j}^{a} \right.}❘} - I} \right) +$ ❘j, 1⟩⟨j, 1❘ ⊗ (2❘ζ_(j)^(a)⟩⟨ζ_(j)^(a)❘ − I)].

That is, the operator reflects |r₂

about |ϕ_(j) ^(a)

when |r₁

is in the state |j, 0), or it reflects about |ζ_(j) ^(a)

when |r₁

is in the state |j, 1

. To implement this operator, we first consider a state preparation operator B_(j) which prepares |ϕ_(j) ^(a)

from the |0

state. By applying, in sequence, the inverse of this state preparation operator, a reflection about the |0

state, and finally the state preparation operator, we find

B _(j)(2|0

0|−I)B _(j) ^(†)=2B _(j)|0

0|B _(j) ^(†) −B _(j) B _(j) ^(†)=2|ϕ_(j) ^(a)

ϕ_(j) ^(a) |−I.  (48)

Thus, this procedure effectively reflects about the state |ϕ_(j) ^(a)

. Likewise, we can reflect about the |ζ_(j) ^(a)

states using an operator B_(j)′ which prepares |ζ_(j) ^(a)

from |0

:

B _(j)′(2|0

0|−I)(B _(j)′)^(†)=2|ζ_(j) ^(a)

ζ_(j) ^(a) |−I.  (49)

The full operator can then be implemented as

$\begin{matrix} {\left. \left. {\left. {{{\left. {{{\left. {\left. {\left. {{{\left. {{{\left. {{{2{TT}^{\dagger}} - I} = {\sum\limits_{j = 0}^{N - 1}\left\lbrack {❘{j,0}} \right.}} \right\rangle\left\langle {j,0} \right.}❘} \otimes \left( {B_{j}\left( {2{❘0}} \right.} \right.} \right\rangle\left\langle 0 \right.}❘} - I} \right)B_{j}^{\dagger}} \right) + {❘{j,1}}} \right\rangle\left\langle {j,1} \right.}❘} \otimes \left( {B_{j}^{\prime}\left( {2{❘0}} \right.} \right.} \right\rangle\left\langle 0 \right.}❘} - I} \right)\left( B_{j}^{\prime} \right)^{\dagger}} \right) \right\rbrack.} & (50) \end{matrix}$

Note that the swap operations involved in the walk operator mean that, at intermediate stages, the system stores essential data on the |1

state of the ancilla, and hence the reflections about the |ζ_(j) ^(a))'s cannot be ignored.

The implementation of the state preparation operators is straightforward. For the B_(j) operators, we begin by preparing a uniform superposition:

$\begin{matrix} {\left. {\frac{1}{\sqrt{N}}{\sum\limits_{j = 0}^{N - 1}{❘{k,0}}}} \right\rangle.} & (51) \end{matrix}$

We can then apply a single Pauli X gate to the ancilla bit to obtain

$\begin{matrix} {\left. {\frac{1}{\sqrt{N}}{\sum\limits_{j = 0}^{N - 1}{❘{k,1}}}} \right\rangle.} & (52) \end{matrix}$

Note that, for A_(jk)=0, the amplitudes of the |k^(a)

states are now exactly as desired. Then for |k

corresponding to nonzero A_(jk), we rotate the ancilla to obtain:

$\begin{matrix} {\left. \left. {\left. {\left. {\frac{1}{\sqrt{N}}{\sum\limits_{k = 0}^{N - 1}{❘k}}} \right\rangle\left\lbrack {\sqrt{\frac{N}{X}A_{jk}^{*}}{❘0}} \right.} \right\rangle + {\sqrt{1 - {\frac{N}{X}{❘A_{jk}❘}}}{❘1}}} \right\rangle \right\rbrack.} & (53) \end{matrix}$

It is at this point that the role of X becomes clear. In order to ensure a valid rotation, we select X such that X/N≤|A_(jk)|_(max). Note that the calculation of √{square root over (A_(jk)*)} requires some additional consideration. In particular, the result of (34) requires that

√{square root over (A _(kj)*)}(√{square root over (A _(jk)*)})*=A _(jk).  (54)

In most cases, this can be satisfied by taking

√{square root over (A _(jk)*)}=√{square root over (|A _(jk)|)}e ^(−iarg(A) ^(jk) ^()/2),

and using the principal square root for √{square root over (|A_(jk)|)}. However, if A_(jk)∈(−∞, 0), then A_(jk)=A_(kj), and we have

√{square root over (A _(kj)*)}(√{square root over (A _(jk)*)})*=(√{square root over (|A _(jk)|)}e ^(−iπ/2))(√{square root over (|A _(jk)|)}e ^(iπ/2))=|A _(jk)|.  (56)

For j≠k, we can recover the correct sign by taking the negative square root in (55) whenever k>j. That is, if A_(jk) is a negative real number, we use

√{square root over (A _(jk)*)}=sign(j−k)|√{square root over (A _(jk)|)}e− ^(iarg(A) ^(jk) ^()/2).  (57)

While this prescription is effective for j≠k, it does not suffice when j=k. To address this case, we simply prevent negative elements from appearing on the diagonal of A by adding an appropriate multiple of the identity matrix. Proper treatment of this modification is considered in section V.

The B_(j)′ operators can be implemented by simply switching the ancilla state of the operand register to |1

. This gives |ζ_(j) ^(a)

=|0

^(⊗n)|1

, which is sufficient for our purposes.

The initial application of T is also of concern. The operation is defined such that, when the |r₁

ancilla qubit is in the |0

state, the |ϕ_(j) ^(a)

states are produced on |r₂

regardless of the initial state of the register. This is problematic to implement in practice, but since the only direct application of T occurs at the beginning of the calculation, we can safely assume that |r₂

begins with all qubits in the |0

state. Then the initial application of T, which we shall distinguish by the term T₀, can be effectively applied by conditional application of the state preparation operators:

$\begin{matrix} {\left. {{{\left. {{{{\left. {T_{0} = {\sum\limits_{j = 0}^{N - 1}\left( {❘{j,0}} \right.}} \right\rangle\left\langle {j,0} \right.}❘} \otimes B_{j}} + {❘{j,1}}} \right\rangle\left\langle {j,1} \right.}❘} \otimes B_{j}^{\prime}} \right).} & (58) \end{matrix}$

Unlike T, this operator is unitary, and hence it is suitable for use in a quantum circuit. Since the initial state must be supplied with ancilla state |0

, it is also possible to ignore the applications of B_(j)′.

While not strictly an issue for a naive implementation, the manner in which controls are applied is important for efficiency. Consider the B_(j) operator. If row j of A contains N_(nz) ^(j) nonzero elements, then B_(j) must apply N_(nz) ^(j) ancilla rotations, each with an n-qubit control. The default in-place control scheme provided by, for example, Qiskit requires time exponential in n to apply this control, thereby destroying the efficiency of the procedure. Reference [24] provides a method for implementing such controlled operations with

(N²) complexity without including any additional qubits, but this approach requires n recursive square roots of the basic unitary to be computed. Even for unitaries where these square roots can be computed easily, the complexity of their implementation in terms of basic gates scales poorly as the precision needed to accurately describe the desired operator increases. This could potentially be addressed by providing a constant cutoff precision, but here we instead opt for a control scheme of complexity

(n) described in [23]. A diagram summarizing the procedure is shown in FIG. 3 . This method has the downside that it requires an additional (n−1)-qubit “work” register to store intermediate calculations related to the control procedure. While this increases the absolute size of system required to apply a solution circuit, it does not affect the overall resource scaling of the procedure, which remains

(n+n_(p)). Additionally, it provides an optimal complexity scaling for the control procedure, and applies the desired unitary directly.

Using this control scheme, the rotation component of B_(j) will require

(N_(nz) ^(j) log(N)) basic gates to implement. The initial Hadamard step to produce the uniform superposition can clearly be implemented with

(log(N)) gates, and the Pauli X gate requires constant complexity. Therefore, the total gate complexity of each B_(j) remains

(N_(zn) ^(j) log(N)). Each application of T₀ and W requires N controlled B_(j) operations, each requiring an (n+1)-qubit control. However, note that the actual application of B_(j) requires only a single control qubit, and hence the complexity of the control procedure is separate from that of B_(j). Then a single controlled B_(j) has

(log(N))+

(N_(nz) ^(j) log(N))=

(N_(nz) ^(j) log(N)) gate complexity. Note that we have assumed N_(nz) ^(j)≥1 for all j, which must always be satisfied for a well-conditioned system. For constant precision, the solution circuit will require a constant number of applications of W and T₀. Then, noting that Σ_(j=0) ^(N−1)N_(nz) ^(j)=N_(nz), this gives the final gate complexity of the solution procedure:

(N _(nz) log(N)).  (59)

The last point of concern is the new procedure for eigenvalue extraction. Where the canonical HHL unitary gives the eigenphase relationship e^(2πiϕ) ^(j) =e^(iλ) ^(j) , the walk unitary has e^(2πiϕ) ^(j) =i{circumflex over (λ)}_(j)±√{square root over (1−{circumflex over (λ)}_(j) ²)}, and hence the extraction procedure must be modified. Recalling that {circumflex over (λ)}_(j)∈[−1,1], this extraction is straightforward if we take the imaginary components:

sin(2πϕ_(j))={circumflex over (λ)}_(j)⇒λ_(j) =X sin(2πϕ_(j)).  (60)

V. Treatment of Arbitrary Matrix Equations

Recall the following list of restrictions that have been imposed on our system:

-   -   1) |b         must be normalized.     -   2) A must be Hermitian.     -   3) N must be a power of two.     -   4) The eigenvalues of A must lie on the interval [−X, X].     -   5) No negative real numbers may appear on the diagonal of A.

In this section, we develop a method by which an arbitrary matrix equation can be modified to satisfy these constraints. To keep our notation consistent, we begin from the following initial problem: Given A₀∈

^(M×M) and |b₀

∈

^(M), find |x

such that

A ₀ |x ₀

=|b ₀

.  (61)

This arbitrary input system provides the foundational elements for an appropriately restricted system.

The first restriction is that |b

is normalized. This is easily satisfied by dividing (61) by the magnitude of |b₀

:

$\begin{matrix} {\left. {\left. {\frac{1}{{b_{0}}_{2}}A_{0}{❘x_{0}}} \right\rangle = {\frac{1}{{b_{0}}_{2}}{❘b_{0}}}} \right\rangle.} & (62) \end{matrix}$

Here we assume that ∥b₀∥₂≠0. Since the zero vector is always a valid solution when ∥b₀∥₂=0, this case is trivial and need not be considered for our purposes.

The second assumption is that the system matrix A must be Hermitian. This is satisfied in general by expanding the problem to the following 2M×2M system:

$\begin{matrix} {{{\frac{1}{{b_{0}}_{2}}\begin{bmatrix} 0 & A_{0} \\ A_{0}^{\dagger} & 0 \end{bmatrix}}\begin{bmatrix} 0 \\ x_{0} \end{bmatrix}} = {{\frac{1}{{b_{0}}_{2}}\begin{bmatrix} b_{0} \\ 0 \end{bmatrix}}.}} & (63) \end{matrix}$

Third, we consider that the size of our quantum system must be a power of 2, as the algorithm is constructed for quantum systems using two-state qubits. Therefore, we define n=┌log(2M)┐ and N=2^(n), and once again expand our system, this time to

$\begin{matrix} {{{{\frac{1}{{b_{0}}_{2}}\begin{bmatrix} 0 & A_{0} & 0 \\ A_{0}^{\dagger} & 0 & 0 \\ 0 & 0 & I_{N - {2M}} \end{bmatrix}}\begin{bmatrix} 0 \\ x_{0} \\ 0 \end{bmatrix}} = {\frac{1}{{b_{0}}_{2}}\begin{bmatrix} b_{0} \\ 0 \\ 0 \end{bmatrix}}},} & (64) \end{matrix}$

where I_(N−2M) is the identity matrix of dimension N−2M, and we have appended N−2M zeros to each vector. Now each vector can be represented by an n-qubit state.

The final problem is the restriction of the eigenvalues of A to the range [−X, X]. Let λ_(max) be the magnitude of the dominant eigenvalue of A. Then we have

λ_(max) ≤N|A _(jk)|_(max) ≤X,  (65)

by the discussion following (53). Thus [−×_(max), ×_(max)]⊆[−X, X] and hence the spectrum of A lies entirely on the required range. That is, for this procedure, no rescaling of the system is required to satisfy the eigenvalue restrictions.

Every element on the diagonal of the system matrix is now either 0 or a positive real number, and hence no negative real elements appear on its diagonal. This accounts for all imposed restrictions, leaving us with the following scheme for the preparation of an appropriate system:

$\begin{matrix} {\left. {{\left. {{A = {\frac{1}{{b_{0}}_{2}}\begin{bmatrix} 0 & A_{0} & 0 \\ A_{0}^{\dagger} & 0 & 0 \\ 0 & 0 & I_{N - {2M}} \end{bmatrix}}},{❘b}} \right\rangle = {\frac{1}{{b_{0}}_{2}}\begin{bmatrix} b_{0} \\ 0 \\ 0 \end{bmatrix}}},{❘x}} \right\rangle = {\begin{bmatrix} 0 \\ x_{0} \\ 0 \end{bmatrix}.}} & (66) \end{matrix}$

Of course, it is possible that A₀ is already Hermitian, in which case some efficiency can be gained by not performing the full expansion as stated above. Instead, only the size restriction must be satisfied. To this end, we redefine n=┌log(M)┐—keeping the definition N=2 n—and expand the system as follows:

$\begin{matrix} {{A = {\frac{1}{{b_{0}}_{2}}\begin{bmatrix} A_{0} & 0 \\ 0 & I_{N - M} \end{bmatrix}}},} & (67) \end{matrix}$ ${\left. \left| b \right. \right\rangle = {\frac{1}{{b_{0}}_{2}}\begin{bmatrix} b_{0} \\ 2 \end{bmatrix}}},$ $\left. \left| x \right. \right\rangle = {\begin{bmatrix} 0 \\ x_{0} \end{bmatrix}.}$

Now it is possible for the system matrix to have negative real values on the diagonal. This can be amended by using a shifted system:

(A+dI)|x

=|b

,  (68)

where d is an upper bound on the magnitude of the offending values on the diagonal of A. For the purposes of the walk operator, A+dI should be used as the system matrix, but note that this has the effect of shifting all eigenvalues of A by d. Hence, in order to directly apply the inverse of A to the initial state, the eigenvalue extraction of (60) must be modified:

λ_(j) =X sin(2πϕ_(j))−d.  (69)

So long as X is calculated from the shifted system matrix, the eigenvalues are still appropriately bounded, and A still requires no additional rescaling to satisfy the eigenvalue restrictions.

VI. Summary

Here we summarize the preceding analysis in the form of a self-contained procedure. We assume that the supplied matrix equation has been properly prepared according to section V. FIG. 4 provides a large-scale pictorial description of the full procedure. Notice that this procedure consists of four main stages: the initial application of T₀, quantum phase estimation, HHL rotation, and uncomputation.

A. Initial Application of T₀

Algorithm 1 Implementation of T₀ 1: for j = 0 ... N − 1 do 2:  Compute the operator B_(j) 3:  Apply B_(j) to |r₂

 with the control  condition that |r₁

 is in the state |j, 0

4: end for

Algorithm 2 Implementation of B_(j) 1: for k = 0 ... n − 1 do 2:  Apply H to qubit k 3: end for 4: for k = 0 ... N − 1 do 5:  θ_(jk) ← arccos ({square root over (|A_(jk)|N/X)}) 6:  ω_(jk) ← −arg(A_(jk))/2 7:  if arg(A_(jk)) = π and j < k then 8:   ω_(jk) ← −ω_(jk) 9:  end if 10:  Apply XP(ω_(jk))XR_(y)(2θ_(jk)) to the ancilla  qubit with the control condition that the  rest of the register is in the state |k

11: end for

The first stage of the procedure is the application of T₀, which maps |r₂

to a superposition of the |ϕ_(j) ^(a)

and |ζ_(j) ^(a)

states defined in section III. A circuit diagram for our suggested implementation of T₀ is shown in FIG. 5 , and a pseudocode description of the operator is given in algorithm 1. In the program, the “TO” function of the “QWOps” module implements this operator. The definition of T₀ depends on the state preparation operators B_(j), and as such we have also provided a circuit diagram for an arbitrary B_(j) in FIG. 6 . The corresponding pseudocode description is given in algorithm 2. In the program, B_(j) is implemented by the “B_(j)” function of the “QWOps” module. Here we have chosen to forgo any application of the B_(j)′ operator, as we can safely presume that the ancilla state of |r₁

will in practice be initialized to |0

.

In this application of T₀, the system undergoes the transformation

$\begin{matrix} {\left. \left. {\left. {\left. {\left. {\left. {\left. {❘{b,0}} \right\rangle{❘{0\ldots 0,0}}} \right\rangle = {\sum\limits_{j = 0}^{N - 1}{\beta_{j}{❘{u_{j},0}}}}} \right\rangle{❘{0\ldots 0,0}}} \right\rangle\overset{T_{0}}{\mapsto}{\sum\limits_{j = 0}^{N - 1}{\frac{\beta_{j}}{\sqrt{2\left( {1 - {\hat{\lambda}}_{j}^{2}} \right)}}\left\lbrack {\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{-}}} \right){❘v_{j}^{+}}} \right.}}} \right\rangle + {\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{+}}} \right){❘v_{j}^{-}}}} \right\rangle \right\rbrack.} & (70) \end{matrix}$

Here we have suppressed the phase and HHL ancilla registers, as they are not subject to the effects of T₀.

B. Quantum Phase Estimation

With |r₁

and |r₂

prepared in the desired superposition of the walk operator's eigenvectors, an application of QPE using W as the unitary writes the eigenphases of W onto the phase register |p

. An expansion of this step, in the typical QPE format, is given in FIG. 8 . A circuit diagram for the walk operator itself is shown in FIG. 9 , and the corresponding pseudocode is given in algorithm 4. The walk operator is implemented in the program by the “W” function of the “QWOps” module. Note that we have made use of our suggested j-independent form of the |ζ_(j) ^(a)

states, wherein |ζ_(j) ^(a)

=|0

^(⊗n)|1). This eliminates the j dependence of the corresponding preparation operator, which we now refer to as simply B′. Since the swap operations can leave important data on the |1

state of |r₁

's ancilla, B′ cannot be ignored as in the initial application of T₀. In the model of our current study, B′ can be implemented by simply applying an X gate to the ancilla of |r₂

. The program implements B′ in the “Bp” function of the “QWOps” module.

After phase estimation, the system is in the state

$\begin{matrix} {\left. {\left. \left. {\left. {\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N_{p} - 1}{\frac{\beta_{j}}{\sqrt{2\left( {1 - {\hat{\lambda}}_{j}^{2}} \right)}}\left\lbrack {{\rho_{jk}^{+}\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{-}}} \right)}{❘v_{j}^{+}}} \right.}}} \right\rangle + {{\rho_{jk}^{-}\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{+}}} \right)}{❘v_{j}^{-}}}} \right\rangle \right\rbrack{❘k}} \right\rangle.} & (71) \end{matrix}$

Here we have reintroduced the phase register, although |a

remains suppressed. As in section II, ρ_(jk) ^(±) extracts accurate eigenvalue approximations by spiking sharply when {tilde over (λ)}_(k) approaches an actual eigenvalue λ_(j).

C. HHL Ancilla Rotation

Algorithm 3 Implementation of the HHL rotation 1: for k = 0 ... N_(p) − 1 do 2:  {tilde over (λ)}_(k) ← Xsin(2πk/N_(p)) − d 3:  if {tilde over (λ)}_(k) ≠ 0 then 4:   Apply the rotation R_(y)[2arccos(C/{tilde over (λ)}_(k))] to |a

, with the control condition that |p

is in the state |k

5:  end if 6: end for

With the phase register holding the eigenphases of W, extraction of the corresponding eigenvalues can proceed according to the analysis of sections IV and V. Specifically, the eigenvalues are calculated according to

λ_(j) =X sin(2πϕ_(j))−d,  (72)

where d=0 can be used if the system was expanded to satisfy the Hermitian system matrix property. Of course, the exact values of ϕ_(j) are not known in general, and in practice approximate eigenvalues must be calculated from the state of the phase register as follows:

$\begin{matrix} {{\hat{\lambda}}_{k} = {{X{\sin\left( {2\pi\frac{k}{N_{p}}} \right)}} - {d.}}} & (73) \end{matrix}$

Once these eigenvalue approximations have been calculated, a rotation operator can be used to apply an eigenvalue factor corresponding to the inverse of the system matrix for every possible state of the phase register, as detailed in section II. A circuit diagram for this procedure is given in FIG. 7 , and the relevant pseudocode is provided in algorithm 3. This rotation is implemented in the program by the “HHLRotation” function of the “QAIgs” module.

Algorithm 4 Implementation of W 1: for j = 0 ... N − 1 do 2:  Compute the state preparation operator B_(j) 3:  Apply the reflector B_(j)(2|0

<0| − I)B_(j) ^(†) to |r₂

 with the control condition that |r₁

 is in the state |j, 0

4: end for 5: Compute the state preparation operator B_(j)′ 6: Apply the reflector B_(j)′(2|0

<0| − I)(B_(j)′)^(†) to |r₂

 with the control condition that the |r₁

 ancilla is in the state |1

7: for j = 0 ... N − 1 do 8:  Apply a swap operation to the j-th qubits of |r₁

 and |r₂

9: end for 10: Apply a swap operation to the ancillae of |r₁

 and |r₂

11: Apply iI to any qubit of |r₁

 or |r₂

Upon completion of this rotation, the system has the state

$\begin{matrix} {\left. \left. {\left. {\left. {\left. \left. {\left. {\sum\limits_{j = 0}^{N - 1}{\sum\limits_{k = 0}^{N_{p} - 1}{\frac{\beta_{j}}{\sqrt{2\left( {1 - {\hat{\lambda}}_{j}^{2}} \right)}}\left\lbrack {{\rho_{jk}^{+}\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{-}}} \right)}{❘v_{j}^{+}}} \right.}}} \right\rangle + {{\rho_{jk}^{-}\left( {1 + {i{\hat{\lambda}}_{j}\mu_{j}^{+}}} \right)}{❘v_{j}^{-}}}} \right\rangle \right\rbrack{❘k}} \right\rangle\left( {\frac{C}{{\overset{\sim}{\lambda}}_{k}}{❘0}} \right.} \right\rangle + {\sqrt{1 - \frac{C^{2}}{{\overset{\sim}{\lambda}}_{k}^{2}}}{❘1}}} \right\rangle \right).} & (74) \end{matrix}$

D. Uncomputation

After rotation, |p

, |r₂

, and the ancilla of |r₁

are uncomputed by applying inverse QPE and T₀ operations. Ideally, these registers are returned to the |0

state, and any other state can be interpreted as a failure of the procedure. This leaves |r₁

entangled with |a

. When |a

takes the state |0

, the state of |r₁

is proportional (up to the error introduced through QPE) to the solution state |x

. Meanwhile, if |a

is in the state |1

, the system is in a failure state. That is, the overall final state of the system is

C|x,0

|0

^(⊗(n+1))|0

^(⊗n) ^(p) |0

+|failure).  (75)

This final state is analogous to (20).

From this description, we see that the full procedure is well defined for any input matrix, with all constituent operations having explicit representations. This is in contrast to the canonical HHL algorithm, where the implementation of the QPE unitary presents an ambiguously defined bottleneck for the procedure.

VII. Results

In developing suitable tests for the practical performance of this procedure, two important limitations must be considered: First, the quantum systems currently available to the public are quite small, with the largest system we have access to offering only 7 qubits [25]. This is the ibmq_jakarta v1.0.23 system, which is one of the IBM Quantum Falcon Processors. Second, errors on these systems can propagate rapidly, with calculations involving more than ˜800 primitive gates being, in our experience, unlikely to yield the expected states. Therefore, when considering a problem suitable for fully quantum analysis, we are at present limited to very short, small calculations. Section VII-A constructs and analyzes such a problem, but it is possible to construct a more satisfying test using classical simulation. By using a classical computer to simulate a quantum system, we gain access to more qubits and eliminate gate errors. Such simulation is extremely inefficient, but we have found that as many as 14 qubits can be simulated for this procedure using available classical systems. Section VII-B considers a larger, less restricted test problem using classical simulation.

Aside from verifying the accuracy of our method, we must also show that it is efficient compared to classical algorithms. For this task, we use the example of sparse approximate inverse (SPAI) preconditioning. Section VII-C is dedicated analyzing the efficiency of preconditioner application.

A. A Fully Quantum Problem

Being limited to 7 qubits, we must consider only the smallest of possible problems. Thus we choose a problem of two unknowns, requiring a single qubit for each of the main portions of |r₁

and |r₂

. Both of these registers require ancillary qubits, and a third ancilla is also required for the eigenvalue rotation. Then we currently stand at 5 qubits accounted for, with 2 left for the phase register. Since we are most concerned with using a minimal number of qubits, we use the exponential time, in-place control scheme provided by default in Qiskit. Thus, no additional qubits are needed for control considerations. These four possible phase states admit no error in the phase estimation, and hence we must choose a problem such that the eigenphases can be exactly represented by two bits.

By (69), the eigenvalues of the system matrix must satisfy

$\begin{matrix} {\lambda_{j} = {{{X{\sin\left( {2\pi\phi_{j}} \right)}} - d} = \left\{ \begin{matrix} {- d} & {{\phi_{j} = 0},\frac{1}{2}} \\ {{X - d},} & {\phi_{j} = \frac{1}{4}} \\ {{{- X} - d},} & {{\phi_{j} = \frac{3}{4}},} \end{matrix} \right.}} & (76) \end{matrix}$

The system

$\begin{matrix} {{A = \begin{bmatrix} {- 2} & 1 \\ 1 & {- 2} \end{bmatrix}},{d = 3},{X = 2},} & (77) \end{matrix}$

satisfies the constraints of our procedure, and has eigenvalues

λ₀=−3=−d,λ ₁=−1=X−d.  (78)

Thus, this system provides a suitable candidate for our analysis. Note that the system is Hermitian, and no expansion is required. For a right-hand side vector, we use an equal superposition of both eigenvectors of A:

$\begin{matrix} {\left. {❘b} \right\rangle = {{\frac{1}{2}\left( {\begin{bmatrix} {- 1} \\ 1 \end{bmatrix} + \begin{bmatrix} 1 \\ 1 \end{bmatrix}} \right)} = {\begin{bmatrix} 0 \\ 1 \end{bmatrix}.}}} & (79) \end{matrix}$

For this problem of known form, some simplification is possible in the various operators of the solution procedure. This allows the size of the final circuit to be significantly reduced. The system matrix defining the walk operator is

$\begin{matrix} {A = {{dI} = {\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}.}}} & (80) \end{matrix}$

Therefore, all B_(j) operators apply the same ancilla rotation:

$\begin{matrix} {{R_{y}\left( {2\arccos\sqrt{1 \cdot \frac{2}{2}}} \right)} = {{R_{y}(0)} = {I.}}} & (81) \end{matrix}$

Since all elements are real, no phase rotation is necessary, and all B_(j) operators can be implemented by simply applying a Hadamard gate to |r₂

. This elimination of the complicated phase and R_(y) gates, both of which also require additional control considerations, greatly reduces the complexity of each B_(j) operator.

This simplification of the B_(j) operators carries through the T₀ and W operators. Without this reduction, the full program produces a circuit consisting of 15,728 basic gates. This figure results from transpilation using the available CX, I, Rz, √{square root over (X)}, and X basis gates. After simplification, the final circuit requires only 2,696 gates. This is a notable reduction, but the circuit is still much too large considering the errors incurred by each gate application. We remedy this by dividing the circuit into many smaller sub-circuits, and running each of these components as its own calculation. By initializing each component based on a classically simulated result from the previous component (rather than continuing from an imprecise result as a direct calculation would), the compounding effect of gate errors can be eliminated. We can then verify the validity of our solution by confirming that the results of each component agree with the simulated results for the same component.

In total, the circuit was divided into 120 components as listed below under the heading “X. Quantum Circuit Components”. Initializations were performed using Qiskit's built-in initialization function using the state vectors produced by classical simulation of the previous components. The results of the calculation are shown in FIG. 10 . We see that good agreement is maintained between the simulated and quantum procedures until the more complex later stages, when gate counts approach and exceed 800. At this point, calculations quickly become unreliable. Note that the sum of the number of gates required for all sub-circuits is significantly larger than the number of gates reported for the direct circuit. This is due to the reinitialization of the system, which adds an unpredictable overhead cost to each operation. The average relative error of the final simulated solution compared to a direct classical solution is 1.12×10⁻¹⁰, which is well within the tolerances prescribed by the program.

B. Simulated Solution

With space available for a slightly larger system, we consider a practical, though still trivial, problem. We consider a calculation of the charge per unit length on a transmission line consisting of two long, conducting strips of known potentials radiating in free space. This problem can be modeled as a method of moments discretization of a cross-section of the line, yielding a matrix equation for the element charges |Q

as a function of their potentials IV

:

B|Q

=|V

.  (82)

Elements of the matrix B are given by [28]:

$\begin{matrix} {B_{jk} = \left\{ \begin{matrix} {{- {\frac{l_{j}}{2{\pi\varepsilon}_{0}}\left\lbrack {{\ln\left( l_{j} \right)} - 1.5} \right\rbrack}},} & {j = k} \\ {{{- \frac{l_{j}}{2{\pi\varepsilon}_{0}}}{\ln\left( d_{jk} \right)}},} & {j \neq k} \end{matrix} \right.} & (83) \end{matrix}$

where l_(j) is the length of the j-th one-dimensional boundary element and d_(jk) is the separation between the centroids of elements j and k. By using elements of uniform size l, we can ensure that B is Hermitian. We give each strip unit width, and orient both strips parallel to each other with unit separation.

TABLE I Comparison of Simulated Quantum and Direct Classical Solution Vectors Element Index Quantum [nC] Classical [nC] Relative Error 0 0.0383 0.0371 0.0315 1 0.0383 0.0371 0.0315 2 −0.0383 −0.0371 0.0315 3 −0.0383 −0.0371 0.0315

The calculated charge density for each element is shown in FIG. 11 , and the solution vector and its error are given in table I. For this calculation, four unknowns and seven phase qubits were used. We see that the quantum results are within ˜3% of the correct solution, showing that our procedure produces a reliable approximation. For more accurate solutions, a more complex system involving additional phase qubits would need to be simulated.

C. Preconditioner Application

Here we consider the calculation of charge density per unit length on a two-conductor rectangular transmission line using the same method of moments approach as in the previous section. For reference, a classical solution is shown in FIG. 12 . This geometry is too complex for our quantum procedure to solve outright in satisfactory detail, but the larger density of charge elements provides a more enlightening example for preconditioning than the previous two-strip example. To generate the preconditioner, we follow the same procedure as when generating the total system matrix, but only include elements corresponding to positions which lie within a certain distance δ of each other (we use four times the basic element size). Explicitly, for preconditioner P,

$\begin{matrix} {P_{jk} = \left\{ \begin{matrix} {{- {\frac{l_{j}}{2{\pi\varepsilon}_{0}}\left\lbrack {{\ln\left( l_{j} \right)} - 1.5} \right\rbrack}},} & {j = k} \\ {{{- \frac{l_{j}}{2{\pi\varepsilon}_{0}}}{\ln\left( d_{jk} \right)}},} & {j \neq k} \\ {0,} & {otherwise} \end{matrix} \right.} & (84) \end{matrix}$

By applying P⁻¹ to the right-hand side vector of the matrix equation prior to performing an iterative solution procedure, the total number of iterations needed to solve the system can be drastically reduced [20]. However, even though P is generally sparse, P⁻¹ can still be quite dense, as illustrated in FIG. 13 . This makes efficient classical application of the inverse preconditioner difficult, and often impossible. However, we have already shown that our quantum procedure can apply P in

(N_(nz) log(N)) time, regardless of the sparsity of P⁻¹.

FIG. 14 shows the time needed to apply the inverse preconditioner classically using GMRES for various N. For the preconditioning scheme used, matrices contained 5 elements per row, with no significant dependence on N, and hence N_(nz)=

(N). We see that for large matrices, the time required increases roughly as

(N³), showing that no advantage whatsoever is gained from the sparsity of the initial matrix. For the quantum procedure, FIG. 15 shows the size in gates of the final preconditioner inversion circuits, as well as the time taken to compute these circuits. We see that the expected

(N log(N)) scaling is obtained, and therefore the quantum procedure is, asymptotically, more efficient than the classical procedure.

It is worth noting that the quantum procedure takes a very long time to produce a solution circuit for even modest problem sizes, limiting practical applicability to extremely large problems where the improved scaling can overcome the initial time difference. FIG. 16 gives a first-order extrapolation of our results to provide a rough prediction of the point where the quantum procedure can be expected to outperform a classical system. We predict this to hold true for problems of more than roughly 8×10⁵ unknowns, which would certainly indicate a relatively sophisticated problem.

Unfortunately, we are not able to analyze the time complexity of the solution circuit execution due to the limitations of available hardware. The total number of qubits required for a system of size N is

2n+2(n−1)+2+n _(p)+1=4n+n _(p)+1,  (85)

accounting for the base registers and their ancillae, the control registers, the phase register (which could also require its own work register for controls, but we consider it to have constant size and therefore omit this extra dependence), and the HHL ancilla. Even with a trivial single-qubit phase estimation, a system of 26 qubits would be required to invert our smallest preconditioner (N=64). Since the largest system we can access provides only 7 qubits, this calculation is quite beyond the capabilities of available hardware. Note that, by this calculation, 82 qubits would be required at our estimated crossover point of quantum/classical efficiency (using n=20 as the smallest sufficient power of two).

VIII. Conclusion

By combining the known HHL algorithm with a unitary adopted from quantum walk research, we have developed a method for the solution of any well-conditioned matrix equation which is suitable for direct implementation on quantum hardware. The method has demonstrated

(N_(nz) log(N)) complexity in time and gate count, and for sparse matrices is expected to outperform classical solvers for problems of N≥8×10⁵ unknowns.

While the method itself is suitable for practical implementation, available quantum systems are far too small and unreliable to support the analysis of any nontrivial problem. This situation is expected to improve rapidly, however, with IBM projecting the release of a 1,000 qubit system by the end of 2023 [29]. They also anticipate a dramatic decrease in errors [30]. Google has also indicated plans to develop a commercial-grade system by 2029 [31].

IX. Reflection Operators

Here we briefly describe the nature of reflection operators. In particular, we consider operators of the form 2|ν

v|−I, where |ν

is some normalized vector. This operator, when applied to another vector |w

of the same dimension, reflects |w

about |ν

. As an initial example, consider the two-dimensional case where Iv) is the unit vector along the y-axis, |{circumflex over (γ)}

, and |w

=a|{circumflex over (x)}

+b|{circumflex over (γ)}

is arbitrary. Then the effect of the reflection operator is as follows:

$\begin{matrix} \begin{matrix} \left. \left. {\left. {\left. {\left. {{\left. {\left. \left. {\left. {\left. {{{\left. \left( {2{❘\hat{y}}} \right. \right\rangle\left\langle \hat{y} \right.}❘} - I} \right)\left( {a{❘\hat{x}}} \right.} \right\rangle + {b{❘\hat{y}}}} \right\rangle \right) = \left( {2a{❘\hat{y}}} \right.} \right\rangle\left\langle {\hat{y}{❘\hat{x}}} \right\rangle} + {2b{❘\hat{y}}}} \right\rangle\left\langle {\hat{y}{❘\hat{y}}} \right\rangle} \right) - \left( {a{❘\hat{x}}} \right.} \right\rangle + {b{❘\hat{y}}}} \right\rangle \right) \\ \left. \left. {\left. {\left. {= {2b{❘\hat{y}}}} \right\rangle - \left( {a{❘\hat{x}}} \right.} \right\rangle + {b{❘\hat{y}}}} \right\rangle \right) \\ {\left. {{{\left. {= {{- a}{❘\hat{x}}}} \right\rangle + b}❘}\hat{y}} \right\rangle.} \end{matrix} & (86) \end{matrix}$

That is, the x component of |w

is negated, while the y component remains unchanged. FIG. 17 illustrates this behavior, and emphasizes the reflection of the vector.

In general, the operand vector |w

consists of components both perpendicular and parallel to |ν

. Thus the vector can be written as |w

=a|w_(∥)

+b|w_(⊥)

, and the action of the reflector is

$\begin{matrix} \begin{matrix} {\left. {\left. {{\left. {\left. \left. {\left. {\left. {{{\left. \left( {2{❘v}} \right. \right\rangle\left\langle v \right.}❘} - I} \right)\left( {a{❘w_{}}} \right.} \right\rangle + {b{❘w_{\bot}}}} \right\rangle \right) = \left( {2a{❘v}} \right.} \right\rangle\left\langle {v{❘w_{}}} \right\rangle} + {2b{❘v}}} \right\rangle\left\langle {v{❘w_{\bot}}} \right\rangle} \right) -} \\ \left. \left. {\left. {}\left( {a{❘w_{}}} \right. \right\rangle + {b{❘w_{\bot}}}} \right\rangle \right) \\ \left. \left. {\left. {\left. {= {2a{❘w_{}}}} \right\rangle - \left( {a{❘w_{}}} \right.} \right\rangle + {b{❘w_{\bot}}}} \right) \right\rangle \\ {\left. {{{\left. {= {a{❘w_{}}}} \right\rangle - b}❘}w_{\bot}} \right\rangle.} \end{matrix} & (87) \end{matrix}$

Then the arbitrary reflector 2|ν

ν|−I has the effect of negating the perpendicular component of the operand vector, while leaving the parallel component unchanged.

X. Quantum Circuit Components

This section lists the individual operations which constitute each component of the divided circuit described in section VII-A. Operations are given in Qiskit-style syntax similar to that used in the program. Operators are listed first, with the operand registers listed on the following line. We assume that C, X, and d have been defined. Note that each of these components also includes the operations necessary to initialize it to the ideal state resulting from the precise application of all previous components. These operations, applied in sequence to an appropriately initialized system, constitute the solution procedure for the relevant system.

1: # initial T0 2: HGate( ) 3:  reg_r2 4: 5: # QPE 6: Hgate( ) 7:  [reg_phase[0]] 8: Hgate( ) 9:  [reg_phase[1]] 10: 11: Hgate( ).control(2,None,‘01’) 12:  [reg_phase[0]]+[reg_r1a[0]]+[reg_r2[0]] 13: Xgate( ).control(2,None,‘11’) 14:  [reg_phase[0]]+[reg_r1a[0]]+[reg_r2a[0]] 15: Zgate( ).control(1,None,‘1’) 16:  [reg_phase[0]]+[reg_r2[0]] 17: Xgate( ).control(1,None,‘1’) 18:  [reg_phase[0]]+[reg_r2[0]] 19: Zgate( ).control(1,None,‘1’) 20:  [reg_phase[0]]+[reg_r2[0]] 21: Xgate( ).control(1,None,‘1’) 22:  [reg_phase[0]]+[reg_r2[0]] 23: Xgate( ).control(2,None,‘01’) 24:  [reg_phase[0]]+reg_r2[:]+reg_r2a[:] 25: Zgate( ).control(2,None,‘01’) 26:  [reg_phase[0]]+reg_r2[:]+reg_r2a[:] 27: Xgate( ).control(2,None,‘01’) 28:  [reg_phase[0]]+reg_r2[:]+reg_r2a[:] 29: Hgate( ).control(2,None,‘01’) 30:  [reg_phase[0]]+[reg_r1a[0]]+[reg_r2[0]] 31: Xgate( ).control(2,None,‘11’) 32:  [reg_phase[0]]+[reg_r1a[0]]+[reg_r2a[0]] 33: SwapGate( ).control(1,None,‘1’) 34:  [reg_phase[0]]+reg_r1[:]+reg_r2[:] 35: SwapGate( ).control(1,None,‘1’) 36:  [reg_phase[0]]+reg_r1a[:]+reg_r2a[:] 37: Sgate( ).control(1,None,‘1’) 38:  [reg_phase[0]]+[reg_r1[0]] 39: Xgate( ).control(1,None,‘1’) 40:  [reg_phase[0]]+[reg_r1[0]] 41: Sgate( ).control(1,None,‘1’) 42:  [reg_phase[0]]+[reg_r1[0]] 43: Xgate( ).control(1,None,‘1’) 44:  [reg_phase[0]]+[reg_r1[0]] 45: 46: Hgate( ).control(2,None,‘01’) 47:  [reg_phase[1]]+[reg_r1a[0]]+[reg_r2[0]] 48: Xgate( ).control(2,None,‘11’) 49:  [reg_phase[1]]+[reg_r1a[0]]+[reg_r2a[0]] 50: Zgate( ).control(1,None,‘1’) 51:  [reg_phase[1]]+[reg_r2[0]] 52: Xgate( ).control(1,None,‘1’) 53:  [reg_phase[1]]+[reg_r2[0]] 54: Zgate( ).control(1,None,‘1’) 55:  [reg_phase[1]]+[reg_r2[0]] 56: Xgate( ).control(1,None,‘1’) 57:  [reg_phase[1]]+[reg_r2[0]] 58: Xgate( ).control(2,None,‘01’) 59:  [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 60: Zgate( ).control(2,None,‘01’) 61:  [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 62: Xgate( ).control(2,None,‘01’) 63:  [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 64: Hgate( ).control(2,None,‘01’) 65:  [reg_phase[1]]+[reg_r1a[0]]+[reg_r2[0]] 66: Xgate( ).control(2,None,‘11’) 67:  [reg_phase[1]]+[reg_r1a[0]]+[reg_r2a[0]] 68: SwapGate( ).control(1,None,‘1’) 69:  [reg_phase[1]]+reg_r1[:]+reg_r2[:] 70: SwapGate( ).control(1, None,‘1’) 71:  [reg_phase[1]]+reg_r1a[:]+reg_r2a[:] 72: Sgate( ).control(1,None,‘1’) 73:  [reg_phase[1]]+[reg_r1[0]] 74: Xgate( ).control(1,None,‘1’) 75:  [reg_phase[1]]+[reg_r1[0]] 76: Sgate( ).control(1,None,‘1’) 77:  [reg_phase[1]]+[reg_r1[0]] 78: Xgate( ).control(1,None,‘1’) 79:  [reg_phase[1]]+[reg_r1[0]] 80: 81: Hgate( ).control(2,None,‘01’) 82:  [reg_phase[1]]+[reg_r1a[0]]+[reg_r2[0]] 83: Xgate( ).control(2,None,‘11’) 84:  [reg_phase[1]]+[reg_r1a[0]]+[reg_r2a[0]] 85: Zgate( ).control(1,None,‘1’) 86:  [reg_phase[1]]+[reg_r2[0]] 87: Xgate( ).control(1,None,‘1’) 88:  [reg_phase[1]]+[reg_r2[0]] 89: Zgate( ).control(1,None,‘1’) 90:  [reg_phase[1]]+[reg_r2[0]] 91: Xgate( ).control(1,None,‘1’) 92:  [reg_phase[1]]+[reg_r2[0]] 93: Xgate( ).control(2,None,‘01’) 94:  [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 95: Zgate( ).control(2,None,‘01’) 96:  [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 97: Xgate( ).control(2,None,‘01’) 98:  [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 99: Hgate( ).control(2,None,‘01’) 100:    [reg_phase[1]]+[reg_r1a[0]]+[reg_r2[0]] 101:   Xgate( ).control(2,None,‘11’) 102:    [reg_phase[1]]+[reg_r1a[0]]+[reg_r2a[0]] 103:   SwapGate( ).control(1,None,‘1’) 104:    [reg_phase[1]]+reg_r1[:]+reg_r2[:] 105:   SwapGate( ).control(1,None,‘1’) 106:    [reg_phase[1]]+reg_r1a[:]+reg_r2a[:] 107:   Sgate( ).control(1,None,‘1’) 108:    [reg_phase[1]]+[reg_r1[0]] 109:   Xgate( ).control(1,None,‘1’) 110:    [reg_phase[1]]+[reg_r1[0]] 111:   Sgate( ).control(1,None,‘1’) 112:    [reg_phase[1]]+[reg_r1[0]] 113:   Xgate( ).control(1,None,‘1’) 114:    [reg_phase[1]]+[reg_r1[0]] 115: 116:   SwapGate( ) 117:    reg_phase 118:   Hgate( ) 119:    [reg_phase[0]] 120:   CZGate( ).power(0.5).inverse( ) 121:    reg_phase 122:   Hgate( ) 123:    [reg_phase[1]] 124: 125:   # HHL ancilla rotation 126:   RYGate(2.0*math.acos(C/   (−d))).control(nq_phase,None,‘00’) 127:    reg_phase[:]+reg_a_hhl[:] 128:   RYGate(2.0*math.acos(C/   (X−d))).control(nq_phase,None,‘01’) 129:    reg_phase[:]+reg_a_hhl[:] 130:   RYGate(2.0*math.acos(C/   (−d))).control(nq_phase,None,‘10’) 131:    reg_phase[:]+reg_a_hhl[:] 132:   RYGate(2.0*math.acos(C/   (−X−d))).control(nq_phase,None,‘11’) 133:    reg_phase[:]+reg_a_hhl[:] 134: 135:   # inverse QPE 136:   Hgate( ) 137:    [reg_phase[1]] 138:   CZGate( ).power(0.5) 139:    reg_phase 140:   Hgate( ) 141:    [reg_phase[0]] 142:   SwapGate( ) 143:    reg_phase 144: 145:   Xgate( ).control(1,None,‘1’) 146:    [reg_phase[1]]+[reg_r1[0]] 147:   Sgate( ).inverse( ).control(1,None,‘1’) 148:    [reg_phase[1]]+[reg_r1[0]] 149:   Xgate( ).control(1,None,‘1’) 150:    [reg_phase[1]]+[reg_r1[0]] 151:   Sgate( ).inverse( ).control(1,None,‘1’) 152:    [reg_phase[1]]+[reg_r1[0]] 153:   SwapGate( ).control(1,None,‘1’) 154:    [reg_phase[1]]+reg_r1a[:]+reg_r2a[:] 155:   SwapGate( ).control(1,None,‘1’) 156:    [reg_phase[1]]+reg_r1[:]+reg_r2[:] 157:   Xgate( ).control(2,None,‘11’) 158:    [reg_phase[1]]+[reg_r1a[0]]+[reg_r2a[0]] 159:   Hgate( ).control(2,None,‘01’) 160:    [reg_phase[1]]+[reg_r1a[0]]+[reg_r2[0]] 161:   Xgate( ).control(2,None,‘01’) 162:    [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 163:   Zgate( ).control(2,None,‘01’) 164:    [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 165:   Xgate( ).control(2,None,‘01’) 166:    [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 167:   Xgate( ).control(1,None,‘1’) 168:    [reg_phase[1]]+[reg_r2[0]] 169:   Zgate( ).control(1,None,‘1’) 170:    [reg_phase[1]]+[reg_r2[0]] 171:   Xgate( ).control(1,None,‘1’) 172:    [reg_phase[1]]+[reg_r2[0]] 173:   Zgate( ).control(1,None,‘1’) 174:    [reg_phase[1]]+[reg_r2[0]] 175:   Xgate( ).control(2,None,‘11’) 176:    [reg_phase[1]]+[reg_r1a[0]]+[reg_r2a[0]] 177:   Hgate( ).control(2,None,‘01’) 178:    [reg_phase[1]]+[reg_r1a[0]]+[reg_r2[0]] 179: 180:   Xgate( ).control(1,None,‘1’) 181:    [reg_phase[1]]+[reg_r1[0]] 182:   Sgate( ).inverse( ).control(1,None,‘1’) 183:    [reg_phase[1]]+[reg_r1[0]] 184:   Xgate( ).control(1,None,‘1’) 185:    [reg_phase[1]]+[reg_r1[0]] 186:   Sgate( ).inverse( ).control(1,None,‘1’) 187:    [reg_phase[1]]+[reg_r1[0]] 188:   SwapGate( ).control(1,None,‘1’) 189:    [reg_phase[1]]+reg_r1a[:]+reg_r2a[:] 190:   SwapGate( ).control(1,None,‘1’) 191:    [reg_phase[1]]+reg_r1[:]+reg_r2[:] 192:   Xgate( ).control(2,None,‘11’) 193:    [reg_phase[1]]+[reg_r1a[0]]+[reg_r2a[0]] 194:   Hgate( ).control(2,None,‘01’) 195:    [reg_phase[1]]+[reg_r1a[0]]+[reg_r2[0]] 196:   Xgate( ).control(2,None,‘01’) 197:    [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 198:   Zgate( ).control(2,None,‘01’) 199:    [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 200:   Xgate( ).control(2,None,‘01’) 201:    [reg_phase[1]]+reg_r2[:]+reg_r2a[:] 202:   Xgate( ).control(1,None,‘1’) 203:    [reg_phase[1]]+[reg_r2[0]] 204:   Zgate( ).control(1,None,‘1’) 205:    [reg_phase[1]]+[reg_r2[0]] 206:   Xgate( ).control(1,None,‘1’) 207:    [reg_phase[1]]+[reg_r2[0]] 208:   Zgate( ).control(1,None,‘1’) 209:    [reg_phase[1]]+[reg_r2[0]] 210:   Xgate( ).control(2,None,‘11’) 211:    [reg_phase[1]]+[reg_r1a[0]]+[reg_r2a[0]] 212:   Hgate( ).control(2,None,‘01’) 213:    [reg_phase[1]]+[reg_r1a[0]]+[reg_r2[0]] 214: 215:   Xgate( ).control(1,None,‘1’) 216:    [reg_phase[0]]+[reg_r1[0]] 217:   Sgate( ).inverse( ).control(1,None,‘1’) 218:    [reg_phase[0]]+[reg_r1[0]] 219:   Xgate( ).control(1,None,‘1’) 220:    [reg_phase[0]]+[reg_r1[0]] 221:   Sgate( ).inverse( ).control(1,None,‘1’) 222:    [reg_phase[0]]+[reg_r1[0]] 223:   SwapGate( ).control(1,None,‘1’) 224:    [reg_phase[0]]+reg_r1a[:]+reg_r2a[:] 225:   SwapGate( ).control(1,None,‘1’) 226:    [reg_phase[0]]+reg_r1[:]+reg_r2[:] 227:   Xgate( ).control(2,None,‘11’) 228:    [reg_phase[0]]+[reg_r1a[0]]+[reg_r2a[0]] 229:   Hgate( ).control(2,None,‘01’) 230:    [reg_phase[0]]+[reg_r1a[0]]+[reg_r2[0]] 231:   Xgate( ).control(2,None,‘01’) 232:    [reg_phase[0]]+reg_r2[:]+reg_r2a[:] 233:   Zgate( ).control(2,None,‘01’) 234:    [reg_phase[0]]+reg_r2[:]+reg_r2a[:] 235:   Xgate( ).control(2,None,‘01’) 236:    [reg_phase[0]]+reg_r2[:]+reg_r2a[:] 237:   Xgate( ).control(1,None,‘1’) 238:    [reg_phase[0]]+[reg_r2[0]] 239:   Zgate( ).control(1,None,‘1’) 240:    [reg_phase[0]]+[reg_r2[0]] 241:   Xgate( ).control(1,None,‘1’) 242:    [reg_phase[0]]+[reg_r2[0]] 243:   Zgate( ).control(1,None,‘1’) 244:    [reg_phase[0]]+[reg_r2[0]] 245:   Xgate( ).control(2,None,‘11’) 246:    [reg_phase[0]]+[reg_r1a[0]]+[reg_r2a[0]] 247:   Hgate( ).control(2,None,‘01’) 248:    [reg_phase[0]]+[reg_r1a[0]]+[reg_r2[0]] 249: 250:   Hgate( ) 251:    [reg_phase[1]] 252:   Hgate( ) 253:    [reg_phase[0]] 254: 255:   # inverse T0 256:   Hgate( ) 257:    reg_r2

XI. References

The following documents are referred in the preceding sections by reference number in brackets [#] and are hereby incorporated herein by reference.

-   [1] T. R. Chandrupatla and A. D. Belegundu, Introduction to Finite     Elements in

Engineering, 4^(th) ed., Harlow, England: Pearson, 2012.

-   [2] W. C. Gibson, The Method of Moments in Electromagnetics, Boca     Raton, FL, USA: Chapman Hall/CRC, 2008. -   [3] M. N. Ozis,ik, H. R. B. Orlande, M. J. Colab,o, and R. M.     Cotta,”Finite Difference Methods in Heat Transfer, 2^(nd) ed., Boca     Raton, FL, USA: CRC Press, 2017. -   [4] W. C. Chew, J. M. Jin, E. Michielssen, and J. Song, Fast and     Efficient Algorithms in Computational Electromagnetics, Norwood, MA,     USA: Artech House, 2001. -   [5] Z. Chen, S. Zheng, and V. I. Okhmatovski, “Tensor train     accelerated solution of volume integral equation for 2-D scattering     problems and magneto-quasi-static characterization of multiconductor     transmission lines,” IEEE Trans. Microw. Theory Tech., vol. 67, no.     6, pp. 2181-2196, June 2019, DOI: 10.1109/TMTT.2019.2908368. -   [6] S. Omar and D. Jiao, “A linear complexity direct volume integral     equation solver for full-wave 3-D circuit extraction in     inhomogeneous materials,” IEEE Trans. Microw. Theory Techn., vol.     63, no. 3, pp. 897— 912, March 2015. -   [7] L. K. Grover, “A Fast Quantum Mechanical Algorithm for Database     Search,” in Proc. 28th Annu. ACM Symp. Theory Comput., pp. 212-219,     July 1996, DOI: -   [8] E. Gerjuoy, “Shor's factoring algorithm and modern cryptography.     An illustration of the capabilities inherent in quantum computers,”     Amer. J. Phys., vol. 73, no. 6, pp. 521-540, May 2005, DOI:     10.1119/1.1891170. -   [9] A. W. Harrow, A. Hassidim, and S. Lloyd, “Quantum algorithm for     linear systems of equations,” Phys. Rev. Lett., vol. 103, no. 15, p.     150502, October 2009, DOI: -   [10] R. Cleve, A. Ekert, C. Macchiavello, and M. Mosca, “Quantum     algorithms revisited,” Proc. R. Soc. Lond. A., vol. 454, no. 1969,     pp. 339— 354, January 1998, DOI: -   [11] A. M. Childs, “On the relationship between continuous- and     discretetime quantum walk,” Commun. Math. Phys., vol. 294, no. 2,     pp. 581— 603, March 2010, DOI: 10.1007/s00220-009-0930-1. -   [12] D. W. Berry and A. M. Childs, “Black-box Hamiltonian simulation     and unitary implementation,” Quantum Info. Comput., vol. 12, no. 12,     pp. 29-62, January 2012. -   [13] I. Kerenidis and A. Prakash, “Quantum gradient descent for     linear systems and least squares,” Phys. Rev. A, vol. 101, no. 2, p.     022316, February 2020, DOI: 10.1103/PhysRevA.101.022316. -   [14] M. S. Anis et al., “Qiskit: An Open-source Framework for     Quantum Computing,” 2021, DOI: 10.5281/zenodo.2573505. -   [15] C. D. Phillips and V. I. Okhmatovski, “QMES,” 2021. [GitHub     repository]. Available: https://github.com/philli69/QMES. -   [16] S. E. Venegas-Andraca, “Quantum walks: a comprehensive review,”     Quantum Inf. Process., vol. 11, no. 5, pp. 1015-1106, July 2012,     DOI: 10.1007/s11128-012-0432-5. -   [17] J. Kempe, “Quantum random walks: An introductory overview,”     Contemporary Physics, vol. 44, no. 4, pp. 307-327, July-August 2003,     DOI: -   [18] A. Ambainis, “Quantum walk algorithm for element distinctness,”     in Proc. 45th Annu. IEEE Symp. on Found. of Comput. Sci., pp. 22-31,     October 2004, DOI: -   [19] M. Szegedy, “Quantum Speed-Up of Markov Chain Based     Algorithms,” in Proc. 45th Annu. IEEE Symp. on Found. of Comput.     Sci., pp. 32-41, October 2004, DOI: 10.1109/FOCS.2004.53. -   [20] X. Pan and X. Sheng, “Sparse approximate inverse preconditioner     for multiscale dynamic electromagnetic problems,” Radio Science,     vol. 49, no. 11, pp. 1041-1051, November 2014, DOI:     10.1002/2014RS005387. -   [21] T. Takahashi, P. Coulier, and E. Darve, “Application of the     inverse fast multipole method as a preconditioner in a 3D Helmholtz     boundary element method,” J. Comp. Phys., vol. 341, pp. 406-428,     July 2017. -   [22] S. Casacuberta and R. Kyng, “Faster Sparse Matrix Inversion and     Rank Computation in Finite Fields,” 2021, arXiv:2106.09830. -   [23] M. A. Nielsen and I. L. Chuang, “Quantum Circuits,” in Quantum     Computing and Quantum Information, 1^(st) ed. Cambridge, UK: CUP,     2000, ch. 4, sec. 4.3, pp. 183-184. -   [24] A. Barenco et al., “Elementary gates for quantum computation,”     Phys. Rev. A, vol. 52, no. 5, pp. 3457-3467, November 1995, DOI:     10.1103/PhysRevA.52.3457. -   [25] IBM Quantum. https://quantum-computing.ibm.com/, 2021. -   [26] R. A. Horn and C. R. Johnson, “Hermitian Matrices, Symmetric     Matrices, and Congruence,” in Matrix Analysis, 2^(nd) ed., New York,     NY, USA: CUP, 2013, ch. 4, sec. 4.2, p. 234. -   [27] B. C. Hall, “The Matrix Exponential,” in Lie Groups, Lie     Algebras, and Representations: An Elementary Introduction, 2^(nd)     ed., Cham, Switzerland: Springer, 2015, ch. 2, sec 2.1, p. 31. -   [28] M. N. O. Sadiku, “Moment Methods,” in Numerical Techniques in     Electromagnetics, 2^(nd) ed., Boca Raton, FL, USA: CRC Press, 2001,     ch. 5, sec. 5.4, p. 312. -   [29] A. Cho, “IBM promises 1000-qubit quantum computer—a     milestone—by 2023,” Science, September, 2021. Accessed on: Dec.     2, 2021. [Online]. Available:     https://www.science.org/content/article/ibm-promises1000-qubit-quantum-computer-milestone-2023 -   [30] J. Council, “The Decade of Quantum Computing Is Upon Us, IBM     Exec Says,” WSJ, March, 2021. Accessed on: Dec. 2, 2021. [On-line].     Available:     https://www.wsj.com/articles/the-decade-of-quantumcomputing-is-upon-us-ibm-exec-says-11614802190 -   [31] S. Castellanos, “Google Aims for Commercial-Grade Quantum     Computer by 2029,” WSJ, May, 2021. Accessed on: Dec. 2, 2021.     [Online]. Available:     https://www.wsj.com/articles/google-aimsfor-commercial-grade-quantum-computer-by-2029-11621359156

Since various modifications can be made in the invention as herein above described, and many apparently widely different embodiments of same made, it is intended that all matter contained in the accompanying specification shall be interpreted as illustrative only and not in a limiting sense. 

1. A method of solving matrix equations using a quantum computing system, the method comprising: (i) obtaining a matrix equation A|b

where A is an N×N system matrix and |x

and |b

are N-dimensional vectors; (ii) expressing |b

as a superposition of eigenvectors of the system matrix Λ; (iii) translating |b

to a superposition of eigenvectors of a unitary comprising a quantum walk operator defined by reflections about a linear span defined from A; (iv) applying quantum phase estimation using said unitary to the superposition of eigenvectors; (v) applying the inverse of each eigenvalue of system matrix A to its corresponding eigenvector in the translated superposition; (vi) uncomputing by applying inverse phase estimation and eigenvector translation; and (vii) extracting the solution |x

from a result of the previous steps.
 2. The method according to claim 1 further comprising the quantum walk operator containing a reflection operator defined as 2TT^(†) I, where application of T^(†) and T performs projection onto a vector space.
 3. The method according to claim 1 further comprising defining $\left. {\left. {\left. {\left. {T = {\sum\limits_{j = 0}^{N1}\left( {❘{j,0}} \right.}} \right\rangle{❘\phi_{j}^{a}}} \right\rangle\left\langle {j,{0{❘{+ {❘{j,1}}}}}} \right\rangle{❘\zeta_{j}^{n}}} \right\rangle\left\langle {j,{1❘}} \right.} \right),{where}$ $\left. \left. {\left. {\left. {\left. {❘\phi_{j}^{a}} \right\rangle = {\frac{1}{\sqrt{N}}{\sum\limits_{k = 0}^{N - 1}{❘k}}}} \right\rangle\left\lbrack {\sqrt{\frac{N}{X}A_{jk}^{*}}{❘0}} \right.} \right\rangle - {\sqrt{1 - {\frac{N}{X}{❘A_{jk}^{*}}}}{❘1}}} \right\rangle \right\rbrack$ and |ζ_(j) ^(a)

are arbitrary failure states.
 4. The method according to claim 1 further comprising defining the quantum walk operator by the expression W−iS(2TT^(†)−I), where S is a register swap operation.
 5. The method according to claim 1 further comprising, subsequent to quantum phase estimation, extracting eigenvalues λ_(j) and applying ancilla rotation.
 6. The method according to claim 1 further comprising performing initial translation of |b

to a superposition of eigenvectors of W by applying T, and performing uncomputation by applying T^(†).
 7. The method according to claim 1 further comprising preventing negative elements from appearing on the diagonal of system matrix Λ by adding a constant multiple of the identity matrix. 